File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -402,6 +402,33 @@ 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+
406+ @patch ("github3.login" )
407+ def test_get_repos_iterator_with_search_query (self , mock_github ):
408+ """Test the get_repos_iterator function with a search query"""
409+ organization = "my_organization"
410+ repository_list = []
411+ team_name = None
412+ search_query = "org:my-org is:repository archived:false"
413+ github_connection = mock_github .return_value
414+
415+ mock_search_repos = MagicMock ()
416+ github_connection .search_repositories .return_value = mock_search_repos
417+
418+ result = get_repos_iterator (
419+ organization ,
420+ team_name ,
421+ repository_list ,
422+ search_query ,
423+ github_connection ,
424+ )
425+
426+ # 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+
405432
406433
407434class TestGetGlobalProjectId (unittest .TestCase ):
You can’t perform that action at this time.
0 commit comments