Deploy templates: API test nits
Follow up for https://review.openstack.org/#/c/637187.
Change-Id: I98643d3bde61f5cfd233846b9251a0a7b1c46b5c
Story: 1722275
Task: 28679
diff --git a/ironic_tempest_plugin/services/baremetal/v1/json/baremetal_client.py b/ironic_tempest_plugin/services/baremetal/v1/json/baremetal_client.py
index d0c0e2b..08e15cd 100644
--- a/ironic_tempest_plugin/services/baremetal/v1/json/baremetal_client.py
+++ b/ironic_tempest_plugin/services/baremetal/v1/json/baremetal_client.py
@@ -411,13 +411,8 @@
:return: A tuple with the server response and the created deploy
template.
"""
- deploy_template = {'name': name}
-
- for arg in ('extra', 'steps', 'uuid'):
- if arg in kwargs:
- deploy_template[arg] = kwargs[arg]
-
- return self._create_request('deploy_templates', deploy_template)
+ kwargs['name'] = name
+ return self._create_request('deploy_templates', kwargs)
@base.handle_errors
def delete_node(self, uuid):
diff --git a/ironic_tempest_plugin/tests/api/admin/test_deploy_templates.py b/ironic_tempest_plugin/tests/api/admin/test_deploy_templates.py
index a281015..b60e9b3 100644
--- a/ironic_tempest_plugin/tests/api/admin/test_deploy_templates.py
+++ b/ironic_tempest_plugin/tests/api/admin/test_deploy_templates.py
@@ -66,15 +66,15 @@
def test_show_deploy_template(self):
_, template = self.client.show_deploy_template(self.template['uuid'])
self._assertExpected(self.template, template)
- self.assertIn('name', template)
- self.assertIn('steps', template)
+ self.assertEqual(self.name, template['name'])
+ self.assertEqual(self.steps, template['steps'])
self.assertIn('uuid', template)
- self.assertIn('extra', template)
+ self.assertEqual({}, template['extra'])
@decorators.idempotent_id('2fd98e9a-10ce-405a-a32c-0d6079766183')
def test_show_deploy_template_with_links(self):
_, template = self.client.show_deploy_template(self.template['uuid'])
- self.assertIn('links', template.keys())
+ self.assertIn('links', template)
self.assertEqual(2, len(template['links']))
self.assertIn(template['uuid'], template['links'][0]['href'])
@@ -115,9 +115,9 @@
self.assertIn(uuid, templates_dict)
template = templates_dict[uuid]
self.assertIn('name', template)
- self.assertIn('steps', template)
+ self.assertEqual(self.steps, template['steps'])
self.assertIn('uuid', template)
- self.assertIn('extra', template)
+ self.assertEqual({}, template['extra'])
# Verify self link.
self.validate_self_link('deploy_templates', template['uuid'],
template['links'][0]['href'])