diff --git a/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/__init__.py b/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/__init__.py index d019ea3c..cc682bda 100644 --- a/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/__init__.py +++ b/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/__init__.py @@ -56,20 +56,22 @@ def _validate_configuration( if provision_plan: try: - validate_provision_plan(test_plan) + validate_provision_plan(provision_plan) # Make sure the user created at provision time is # the same used during the test phase. provision_plan["config"]["username"] = username provision_plan["config"]["password"] = password - provisioning_data["custom_testplan"] = provision_plan + provisioning_data["custom_provision_plan"] = provision_plan except ValueError as e: raise ProvisioningError from e - urls = self.job_data["provision_data"].get("urls", []) - validate_urls(urls) + try: + validate_urls(urls) + except ValueError as e: + raise ProvisioningError from e provisioning_data["urls"] = urls return ((), provisioning_data) diff --git a/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/tests/test_zapper_iot.py b/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/tests/test_zapper_iot.py index ebaae04b..4d96452e 100644 --- a/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/tests/test_zapper_iot.py +++ b/device-connectors/src/testflinger_device_connectors/devices/zapper_iot/tests/test_zapper_iot.py @@ -35,7 +35,7 @@ def test_validate_configuration(self): self.assertEqual(args, ()) self.assertDictEqual(kwargs, expected) - def test_validate_configuration_tplan(self): + def test_validate_configuration_provision_plan(self): """ Test the function validates a custom test plan when provided. @@ -44,7 +44,7 @@ def test_validate_configuration_tplan(self): device = DeviceConnector() device.job_data = { "provision_data": { - "test_plan": { + "provision_plan": { "config": { "project_name": "name", "username": "admin", @@ -69,7 +69,7 @@ def test_validate_configuration_tplan(self): expected = { "username": "ubuntu", "password": "ubuntu", - "custom_testplan": { + "custom_provision_plan": { "config": { "project_name": "name", "username": "ubuntu", # this gets overridden @@ -110,14 +110,14 @@ def test_validate_configuration_invalid_url(self): with self.assertRaises(ProvisioningError): device._validate_configuration() - def test_validate_configuration_invalid_test_plan(self): + def test_validate_configuration_invalid_provision_plan(self): """ Test the function raises an exception if the provided custom testplan is not valid. """ device = DeviceConnector() - device.job_data = {"provision_data": {"test_plan": {"key1": "value1"}}} + device.job_data = {"provision_data": {"provision_plan": {"key1": "value1"}}} device.config = {"reboot_script": []} with self.assertRaises(ProvisioningError):