def test_gather_repository_list_filter_public_remove( mock_list_all_repositories: Mock): mock_list_all_repositories.return_value = [ _get_fake_repository_tuple( owner="owner", name="public", public=True, archived=False, ), _get_fake_repository_tuple( owner="owner", name="private", public=False, archived=False, ), ] result = gather_repository_list( Mock(), filters=[ Filter(FILTER_MODE_ADD, match_owner=".+"), Filter(FILTER_MODE_REMOVE, public=False), ], ) assert len(result) == 1 assert result[0].name == "public"
def test_gather_repository_list_filter_owner(mock_list_all_repositories: Mock): mock_list_all_repositories.return_value = [ _get_fake_repository_tuple( owner="fred", name="fred-repo", public=True, archived=True, ), _get_fake_repository_tuple( owner="boris", name="boris-repo", public=False, archived=False, ), ] result = gather_repository_list( Mock(), filters=[Filter(FILTER_MODE_ADD, match_owner="^fred*")]) assert len(result) == 1 assert result[0].name == "fred-repo"
def test_gather_repository_list_filter_archived( mock_list_all_repositories: Mock): mock_list_all_repositories.return_value = [ _get_fake_repository_tuple( owner="owner", name="archived", public=True, archived=True, ), _get_fake_repository_tuple( owner="owner", name="non-archived", public=False, archived=False, ), ] result = gather_repository_list( Mock(), filters=[Filter(FILTER_MODE_ADD, archived=True)]) assert len(result) == 1 assert result[0].name == "archived"