From 4af894cb6e48cbd926a350419fc24366f39c2ab4 Mon Sep 17 00:00:00 2001 From: Jacob Boddey Date: Sun, 26 Nov 2023 20:55:50 +0000 Subject: [PATCH] Add separate error message if config not completed --- framework/python/src/api/api.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/framework/python/src/api/api.py b/framework/python/src/api/api.py index f332bad74..810e2487d 100644 --- a/framework/python/src/api/api.py +++ b/framework/python/src/api/api.py @@ -33,6 +33,7 @@ DEVICE_MODEL_KEY = "model" DEVICE_TEST_MODULES_KEY = "test_modules" DEVICES_PATH = "/usr/local/testrun/local/devices" +DEFAULT_DEVICE_INTF = "enx123456789123" class Api: """Provide REST endpoints to manage Testrun""" @@ -169,6 +170,13 @@ async def start_test_run(self, request: Request, response: Response): device.firmware = body_json["device"]["firmware"] + # Check if config has been updated (device interface not default) + if (self._test_run.get_session().get_device_interface() + == DEFAULT_DEVICE_INTF): + response.status_code = status.HTTP_400_BAD_REQUEST + return self._generate_msg(False,"Testrun configuration has not yet " + + "been completed.") + # Check Testrun is able to start if self._test_run.get_net_orc().check_config() is False: response.status_code = status.HTTP_500_INTERNAL_SERVER_ERROR