Skip to content

Commit 0a24042

Browse files
committed
test: fix tests by including search_query where needed
Signed-off-by: Zack Koppert <[email protected]>
1 parent 62e4146 commit 0a24042

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

test_env.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def setUp(self):
3939
"TYPE",
4040
"UPDATE_EXISTING",
4141
"REPO_SPECIFIC_EXEMPTIONS",
42+
"REPOSITORY_SEARCH_QUERY",
4243
"SCHEDULE",
4344
"SCHEDULE_DAY",
4445
"LABELS",
@@ -68,6 +69,7 @@ def test_get_env_vars_with_org(self):
6869
expected_result = (
6970
"my_organization",
7071
[],
72+
"", # search_query
7173
None,
7274
None,
7375
b"",
@@ -120,6 +122,7 @@ def test_get_env_vars_with_org_and_repo_specific_exemptions(self):
120122
expected_result = (
121123
"my_organization",
122124
[],
125+
"", # search_query
123126
None,
124127
None,
125128
b"",
@@ -232,6 +235,7 @@ def test_get_env_vars_with_repos(self):
232235
expected_result = (
233236
None,
234237
["org/repo1", "org2/repo2"],
238+
"", # search_query
235239
None,
236240
None,
237241
b"",
@@ -289,6 +293,7 @@ def test_get_env_vars_with_team(self):
289293
expected_result = (
290294
"my_organization",
291295
[],
296+
"", # search_query
292297
None,
293298
None,
294299
b"",
@@ -364,6 +369,7 @@ def test_get_env_vars_optional_values(self):
364369
expected_result = (
365370
"my_organization",
366371
[],
372+
"", # search_query
367373
None,
368374
None,
369375
b"",
@@ -410,6 +416,7 @@ def test_get_env_vars_with_update_existing(self):
410416
expected_result = (
411417
"my_organization",
412418
[],
419+
"", # search_query
413420
None,
414421
None,
415422
b"",
@@ -450,7 +457,7 @@ def test_get_env_vars_missing_org_or_repo(self):
450457
the_exception = cm.exception
451458
self.assertEqual(
452459
str(the_exception),
453-
"ORGANIZATION and REPOSITORY environment variables were not set. Please set one",
460+
"ORGANIZATION, REPOSITORY, and REPOSITORY_SEARCH_QUERY environment variables were not set. Please set one",
454461
)
455462

456463
@patch.dict(
@@ -470,6 +477,7 @@ def test_get_env_vars_auth_with_github_app_installation(self):
470477
expected_result = (
471478
"my_organization",
472479
[],
480+
"", # search_query
473481
12345,
474482
678910,
475483
b"hello",
@@ -559,6 +567,7 @@ def test_get_env_vars_with_repos_no_dry_run(self):
559567
expected_result = (
560568
"my_organization",
561569
[],
570+
"", # search_query
562571
None,
563572
None,
564573
b"",
@@ -605,6 +614,7 @@ def test_get_env_vars_with_repos_disabled_security_updates(self):
605614
expected_result = (
606615
"my_organization",
607616
[],
617+
"", # search_query
608618
None,
609619
None,
610620
b"",
@@ -652,6 +662,7 @@ def test_get_env_vars_with_repos_filter_visibility_multiple_values(self):
652662
expected_result = (
653663
"my_organization",
654664
[],
665+
"", # search_query
655666
None,
656667
None,
657668
b"",
@@ -699,6 +710,7 @@ def test_get_env_vars_with_repos_filter_visibility_single_value(self):
699710
expected_result = (
700711
"my_organization",
701712
[],
713+
"", # search_query
702714
None,
703715
None,
704716
b"",
@@ -776,6 +788,7 @@ def test_get_env_vars_with_repos_filter_visibility_no_duplicates(self):
776788
expected_result = (
777789
"my_organization",
778790
[],
791+
"", # search_query
779792
None,
780793
None,
781794
b"",
@@ -824,6 +837,7 @@ def test_get_env_vars_with_repos_exempt_ecosystems(self):
824837
expected_result = (
825838
"my_organization",
826839
[],
840+
"", # search_query
827841
None,
828842
None,
829843
b"",
@@ -871,6 +885,7 @@ def test_get_env_vars_with_no_batch_size(self):
871885
expected_result = (
872886
"my_organization",
873887
[],
888+
"", # search_query
874889
None,
875890
None,
876891
b"",
@@ -919,6 +934,7 @@ def test_get_env_vars_with_batch_size(self):
919934
expected_result = (
920935
"my_organization",
921936
[],
937+
"", # search_query
922938
None,
923939
None,
924940
b"",
@@ -1056,6 +1072,7 @@ def test_get_env_vars_with_valid_schedule_and_schedule_day(self):
10561072
expected_result = (
10571073
"my_organization",
10581074
[],
1075+
"", # search_query
10591076
None,
10601077
None,
10611078
b"",
@@ -1141,6 +1158,7 @@ def test_get_env_vars_with_a_valid_label(self):
11411158
expected_result = (
11421159
"my_organization",
11431160
[],
1161+
"", # search_query
11441162
None,
11451163
None,
11461164
b"",
@@ -1187,6 +1205,7 @@ def test_get_env_vars_with_valid_labels_containing_spaces(self):
11871205
expected_result = (
11881206
"my_organization",
11891207
[],
1208+
"", # search_query
11901209
None,
11911210
None,
11921211
b"",

test_evergreen.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ def test_get_repos_iterator_with_organization(self, mock_github):
320320
"""Test the get_repos_iterator function with an organization"""
321321
organization = "my_organization"
322322
repository_list = []
323+
search_query = ""
323324
github_connection = mock_github.return_value
324325

325326
mock_organization = MagicMock()
@@ -328,7 +329,7 @@ def test_get_repos_iterator_with_organization(self, mock_github):
328329
github_connection.organization.return_value = mock_organization
329330

330331
result = get_repos_iterator(
331-
organization, None, repository_list, github_connection
332+
organization, None, repository_list, search_query, github_connection
332333
)
333334

334335
# Assert that the organization method was called with the correct argument
@@ -345,14 +346,15 @@ def test_get_repos_iterator_with_repository_list(self, mock_github):
345346
"""Test the get_repos_iterator function with a repository list"""
346347
organization = None
347348
repository_list = ["org/repo1", "org/repo2"]
349+
search_query = ""
348350
github_connection = mock_github.return_value
349351

350352
mock_repository = MagicMock()
351353
mock_repository_list = [mock_repository, mock_repository]
352354
github_connection.repository.side_effect = mock_repository_list
353355

354356
result = get_repos_iterator(
355-
organization, None, repository_list, github_connection
357+
organization, None, repository_list, search_query, github_connection
356358
)
357359

358360
# Assert that the repository method was called with the correct arguments for each repository in the list
@@ -371,6 +373,7 @@ def test_get_repos_iterator_with_team(self, mock_github):
371373
organization = "my_organization"
372374
repository_list = []
373375
team_name = "my_team"
376+
search_query = ""
374377
github_connection = mock_github.return_value
375378

376379
mock_team_repositories = MagicMock()
@@ -382,6 +385,7 @@ def test_get_repos_iterator_with_team(self, mock_github):
382385
organization,
383386
team_name,
384387
repository_list,
388+
search_query,
385389
github_connection,
386390
)
387391

0 commit comments

Comments
 (0)