def test_main_calls(self, keep_images_like_patched, get_auth_schemes_patched): # check if keep_images_like is called when passed --images-like main_loop(parse_args(('-r', 'localhost:8989', '--images-like', 'me'))) keep_images_like_patched.assert_called_with(['a', 'b', 'c'], ['me']) # check if keep_images_like is *not* called when passed --images-like keep_images_like_patched.reset_mock() args = parse_args(('-r', 'localhost:8989')) args.image = [] # this makes the for loop in main_loop not run at all main_loop(args) keep_images_like_patched.assert_not_called()
def test_keep_tags(self, delete_tags_patched, get_auth_schemes_patched): # Check if delete_tags is called from main_loop (directly or indirectly # through delete_tags_by_age) with `keep_tags` set to the tags we want to keep. main_loop(parse_args(('--delete', '--num', '5', '-r', 'localhost:8989', '--keep-tags', '1'))) delete_tags_patched.assert_called_with(TestKeepTags.mock_registry, 'a', False, ['1', '2'], ['1', '3', '4', '5', '6', '7'])