Merge "Add cluster template update test"

This commit is contained in:
Jenkins 2017-01-18 12:08:23 +00:00 committed by Gerrit Code Review
commit fc1998d767
2 changed files with 19 additions and 0 deletions

View File

@ -140,6 +140,12 @@ class DataProcessingClient(rest_client.RestClient):
uri = 'cluster-templates/%s' % tmpl_id
return self._request_and_check_resp(self.delete, uri, 204)
def update_cluster_template(self, tmpl_id, **kwargs):
"""Updates the specificed cluster template."""
uri = 'cluster-templates/%s' % tmpl_id
return self._request_check_and_parse_resp(self.put, uri, 202,
body=json.dumps(kwargs))
def list_data_sources(self):
"""List all data sources for a user."""

View File

@ -130,3 +130,16 @@ class ClusterTemplateTest(dp_base.BaseDataProcessingTest):
templates_info = [template['id']
for template in templates]
self.assertNotIn(template_id, templates_info)
@tc.attr('smoke')
@decorators.idempotent_id('40235aa0-cd4b-494a-9c12-2d0e8a92157a')
def test_cluster_template_update(self):
template_id, _ = self._create_cluster_template()
new_template_name = data_utils.rand_name('sahara-cluster-template')
body = {'name': new_template_name}
updated_template = self.client.update_cluster_template(template_id,
**body)
updated_template = updated_template['cluster_template']
self.assertEqual(new_template_name, updated_template['name'])