Skip to content

Commit

Permalink
renamed testplan to provisionplan
Browse files Browse the repository at this point in the history
  • Loading branch information
p-gentili committed Dec 9, 2024
1 parent 46c5e05 commit c618fe6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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",
Expand All @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit c618fe6

Please sign in to comment.