def test_get_opts_with_args(now): with mock.patch( 'docker_custodian.docker_autostop.timedelta_type', autospec=True ) as mock_timedelta_type: opts = get_opts(args=['--prefix', 'one', '--max-run-time', '24h']) assert opts.max_run_time == mock_timedelta_type.return_value mock_timedelta_type.assert_called_once_with('24h')
def test_get_opts_with_defaults(): opts = get_opts(args=['--prefix', 'one', '--prefix', 'two']) assert opts.timeout == 60 assert opts.dry_run is False assert opts.prefix == ['one', 'two'] assert opts.max_run_time is None