def test_get_args_with_args(): with mock.patch('docker_custodian.docker_gc.timedelta_type', autospec=True) as mock_timedelta_type: opts = docker_gc.get_args(args=[ '--max-image-age', '30 days', '--max-container-age', '3d', ]) assert mock_timedelta_type.mock_calls == [ mock.call('30 days'), mock.call('3d'), ] assert opts.max_container_age == mock_timedelta_type.return_value assert opts.max_image_age == mock_timedelta_type.return_value
def test_get_args_with_args(): with mock.patch( 'docker_custodian.docker_gc.timedelta_type', autospec=True ) as mock_timedelta_type: opts = docker_gc.get_args(args=[ '--max-image-age', '30 days', '--max-container-age', '3d', ]) assert mock_timedelta_type.mock_calls == [ mock.call('30 days'), mock.call('3d'), ] assert opts.max_container_age == mock_timedelta_type.return_value assert opts.max_image_age == mock_timedelta_type.return_value
def test_get_args_with_defaults(): opts = docker_gc.get_args(args=[]) assert opts.timeout == 60 assert opts.dry_run is False assert opts.max_container_age is None assert opts.max_image_age is None