From 16e3278bb6477ff6e9b23ae3c876e647f8e92442 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Thu, 29 Aug 2024 21:11:57 +0100 Subject: [PATCH 1/2] Prevent starting if device is not configured --- framework/python/src/api/api.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/framework/python/src/api/api.py b/framework/python/src/api/api.py index 409884fd1..a1dceb24e 100644 --- a/framework/python/src/api/api.py +++ b/framework/python/src/api/api.py @@ -256,6 +256,11 @@ async def start_testrun(self, request: Request, response: Response): device = self._session.get_device(body_json["device"]["mac_addr"]) + # Check if device is fully configured + if device.status != 'Valid': + response.status_code = status.HTTP_400_BAD_REQUEST + return self._generate_msg(False, "Device configuration is not complete") + # Check Testrun is not already running if self._testrun.get_session().get_status() in [ TestrunStatus.IN_PROGRESS, From 241e4fcc20bc39feaf322ddb05a8105d8e6d3bc0 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Thu, 29 Aug 2024 21:13:08 +0100 Subject: [PATCH 2/2] Fix pylint --- framework/python/src/api/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/python/src/api/api.py b/framework/python/src/api/api.py index a1dceb24e..2218dab6b 100644 --- a/framework/python/src/api/api.py +++ b/framework/python/src/api/api.py @@ -257,7 +257,7 @@ async def start_testrun(self, request: Request, response: Response): device = self._session.get_device(body_json["device"]["mac_addr"]) # Check if device is fully configured - if device.status != 'Valid': + if device.status != "Valid": response.status_code = status.HTTP_400_BAD_REQUEST return self._generate_msg(False, "Device configuration is not complete")