From 634c2e1d687dc2c6d472fa87db1b5d003574550a Mon Sep 17 00:00:00 2001 From: MariusBaldovin Date: Tue, 10 Sep 2024 16:17:33 +0100 Subject: [PATCH] added test for 'system/testpacks' endpoint, fixed typing error in api.py --- framework/python/src/api/api.py | 2 +- testing/api/test_api.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/framework/python/src/api/api.py b/framework/python/src/api/api.py index 9c88613a7..c23a4194e 100644 --- a/framework/python/src/api/api.py +++ b/framework/python/src/api/api.py @@ -1028,6 +1028,6 @@ def get_test_modules(self): def get_test_packs(self): test_packs: list[str] = [] - for test_pack in self._test_run.get_test_orc().get_test_packs(): + for test_pack in self._testrun.get_test_orc().get_test_packs(): test_packs.append(test_pack.name) return test_packs diff --git a/testing/api/test_api.py b/testing/api/test_api.py index 614b0af7f..0dc0d1840 100644 --- a/testing/api/test_api.py +++ b/testing/api/test_api.py @@ -1685,6 +1685,21 @@ def test_get_test_modules(testrun): # pylint: disable=W0613 # Check if the response is a list assert isinstance(response, list) +def test_sys_testpacks(testrun): # pylint: disable=W0613 + """ Test for system testpack endpoint (200) """ + + # Send the get request to the API + r = requests.get(f"{API}/system/testpacks", timeout=5) + + # Check if status code is 200 (ok) + assert r.status_code == 200 + + # Parse the response + response = r.json() + + # Check if the response is a list + assert isinstance(response, list) + # Tests for certificates endpoints def delete_all_certs():