@@ -402,7 +402,7 @@ def test_get_repos_iterator_with_team(self, mock_github):
402
402
403
403
# Assert that the function returned the expected result
404
404
self .assertEqual (result , mock_team_repositories )
405
-
405
+
406
406
@patch ("github3.login" )
407
407
def test_get_repos_iterator_with_search_query (self , mock_github ):
408
408
"""Test the get_repos_iterator function with a search query"""
@@ -411,11 +411,13 @@ def test_get_repos_iterator_with_search_query(self, mock_github):
411
411
team_name = None
412
412
search_query = "org:my-org is:repository archived:false"
413
413
github_connection = mock_github .return_value
414
+ repo1 = MagicMock ()
415
+ repo2 = MagicMock ()
414
416
415
- mock_search_repos = MagicMock ()
416
- github_connection .search_repositories .return_value = mock_search_repos
417
+ # Mock the search_repositories method to return an iterator of repositories
418
+ github_connection .search_repositories .return_value = [ repo1 , repo2 ]
417
419
418
- result = get_repos_iterator (
420
+ get_repos_iterator (
419
421
organization ,
420
422
team_name ,
421
423
repository_list ,
@@ -424,11 +426,7 @@ def test_get_repos_iterator_with_search_query(self, mock_github):
424
426
)
425
427
426
428
# Assert that the search_repositories method was called with the correct argument
427
- github_connection .search_repositories .assert_called_once_with (search_query )
428
-
429
- # Assert that the function returned the expected result
430
- self .assertEqual (result , mock_search_repos )
431
-
429
+ github_connection .search_repositories .assert_called_with (search_query )
432
430
433
431
434
432
class TestGetGlobalProjectId (unittest .TestCase ):
0 commit comments