Merge "Deploy templates: API test nits"

This commit is contained in:
Zuul 2019-03-08 02:39:39 +00:00 committed by Gerrit Code Review
commit 05be5ac2fe
2 changed files with 8 additions and 13 deletions

View File

@ -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):

View File

@ -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'])