Deploy templates: API test nits
Follow up for https://review.openstack.org/#/c/637187. Change-Id: I98643d3bde61f5cfd233846b9251a0a7b1c46b5c Story: 1722275 Task: 28679
This commit is contained in:
parent
3b6041a60f
commit
44bc3dd750
|
@ -411,13 +411,8 @@ class BaremetalClient(base.BaremetalClient):
|
|||
: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):
|
||||
|
|
|
@ -66,15 +66,15 @@ class TestDeployTemplates(base.BaseBaremetalTest):
|
|||
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 @@ class TestDeployTemplates(base.BaseBaremetalTest):
|
|||
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'])
|
||||
|
|
Loading…
Reference in New Issue