Skip to content

Commit 7a7b0f8

Browse files
Further fix after review
1 parent 3ef267e commit 7a7b0f8

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

tests/sq_api_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,16 @@ def mock_analysis_jres(
8080
self,
8181
body: Optional[list[dict]] = None,
8282
status: int = 200,
83+
os_matcher: Optional[str] = "linux",
84+
arch_matcher: Optional[str] = "x86_64",
8385
) -> responses.BaseResponse:
8486
return self.rsps.get(
8587
url=f"{self.api_url}/analysis/jres",
8688
json=body,
8789
status=status,
8890
match=[
8991
matchers.header_matcher({"Accept": "application/json"}),
92+
matchers.query_param_matcher(utils.filter_none_values({"os": os_matcher, "arch": arch_matcher})),
9093
],
9194
)
9295

tests/test_api.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,19 @@ def test_get_analysis_jres(self):
317317
),
318318
]
319319

320-
with self.subTest("get_analysis_jres works"), sq_api_mocker() as mocker:
320+
with self.subTest("get_analysis_jres works (linux)"), sq_api_mocker() as mocker:
321321
mocker.mock_analysis_jres([sq_api_utils.jre_to_dict(jre) for jre in expected_jres])
322322

323323
actual_jres = self.sq.get_analysis_jres(os="linux", arch="x86_64")
324324
self.assertEqual(actual_jres, expected_jres)
325325

326+
with self.subTest("get_analysis_jres works (windows)"), sq_api_mocker() as mocker:
327+
mocker.mock_analysis_jres(
328+
[sq_api_utils.jre_to_dict(jre) for jre in expected_jres], os_matcher="windows", arch_matcher="x86"
329+
)
330+
actual_jres = self.sq.get_analysis_jres(os="windows", arch="x86")
331+
self.assertEqual(actual_jres, expected_jres)
332+
326333
with (
327334
self.subTest("get_analysis_jres returns error"),
328335
sq_api_mocker() as mocker,

0 commit comments

Comments
 (0)