Fix application template update

Updating an application/service in a environment template
does not work and return 404 error.  This patchs solves that
bug.

Change-Id: I03f51c45512c4282ef99ddc1ed9ba55460827a94
Closes-Bug: #1587833
This commit is contained in:
visitor 2016-06-01 13:18:17 +02:00
parent 4cc1bd8079
commit fca418aabc
2 changed files with 24 additions and 0 deletions

View File

@ -331,6 +331,14 @@ class ApplicationCatalogClient(rest_client.RestClient):
self.expected_success(200, resp.status)
return json.loads(body)
def update_service_from_env_template(self, env_template_id, service_id,
post_body):
uri = 'v1/templates/{0}/services/{1}'.format(env_template_id,
service_id)
resp, body = self.put(uri, json.dumps(post_body))
self.expected_success(200, resp.status)
return self._parse_resp(body)
def delete_service_from_env_template(self, env_template_name, service_id):
uri = 'v1/templates/{0}/services/{1}'.format(env_template_name,
service_id)

View File

@ -98,6 +98,22 @@ class TestEnvironmentTemplates(base.BaseApplicationCatalogTest):
get_services_list_in_env_template(self.env_template['id'])
self.assertNotIn(service, services)
@testtools.testcase.attr('smoke')
def test_update_service_in_env_templates(self):
env_template_services = self.application_catalog_client.\
get_services_list_in_env_template(self.env_template['id'])
self.assertIsInstance(env_template_services, list)
post_body = self._get_demo_app()
service = self.application_catalog_client.\
create_service_in_env_template(self.env_template['id'], post_body)
self.assertEqual(post_body['name'], service['name'])
post_body["name"] = "updated_name"
service = self.application_catalog_client.\
update_service_from_env_template(self.env_template['id'],
service["?"]["id"],
post_body)
self.assertEqual("updated_name", service['name'])
@testtools.testcase.attr('smoke')
def test_create_public_env_template(self):
name = utils.generate_name('create_public_env_template')