Skip to content

Commit fed4054

Browse files
Copilotzkoppert
andcommitted
test: add get_repos_iterator search_query test
Co-authored-by: zkoppert <[email protected]>
1 parent 0a24042 commit fed4054

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test_evergreen.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff 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

407434
class TestGetGlobalProjectId(unittest.TestCase):

0 commit comments

Comments
 (0)