@@ -402,7 +402,7 @@ def test_get_repos_iterator_with_team(self, mock_github):
402402
403403 # Assert that the function returned the expected result
404404 self .assertEqual (result , mock_team_repositories )
405-
405+
406406 @patch ("github3.login" )
407407 def test_get_repos_iterator_with_search_query (self , mock_github ):
408408 """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):
411411 team_name = None
412412 search_query = "org:my-org is:repository archived:false"
413413 github_connection = mock_github .return_value
414+ repo1 = MagicMock ()
415+ repo2 = MagicMock ()
414416
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 ]
417419
418- result = get_repos_iterator (
420+ get_repos_iterator (
419421 organization ,
420422 team_name ,
421423 repository_list ,
@@ -424,11 +426,7 @@ def test_get_repos_iterator_with_search_query(self, mock_github):
424426 )
425427
426428 # 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 )
432430
433431
434432class TestGetGlobalProjectId (unittest .TestCase ):
0 commit comments