Move common functions into functional test base-class

The list_resources and update_stack are generic and likely to be used
in multiple tests, so move them into the test base-class.

Change-Id: I20b5399212a3dde514e0785b1fc91be2c30cba04
This commit is contained in:
Steven Hardy 2014-11-20 11:31:55 +00:00
parent 0b2256e461
commit d679feca7a
2 changed files with 20 additions and 20 deletions

View File

@ -304,3 +304,23 @@ class HeatIntegrationTest(testtools.TestCase):
self._wait_for_stack_status(
stack_identifier, 'DELETE_COMPLETE',
success_on_not_found=True)
def update_stack(self, stack_identifier, template, environment=None,
files=None):
env = environment or {}
env_files = files or {}
stack_name = stack_identifier.split('/')[0]
self.client.stacks.update(
stack_id=stack_identifier,
stack_name=stack_name,
template=template,
files=env_files,
disable_rollback=True,
parameters={},
environment=env
)
self._wait_for_stack_status(stack_identifier, 'UPDATE_COMPLETE')
def list_resources(self, stack_identifier):
resources = self.client.resources.list(stack_identifier)
return dict((r.resource_name, r.resource_type) for r in resources)

View File

@ -57,26 +57,6 @@ resources:
super(UpdateStackTest, self).setUp()
self.client = self.orchestration_client
def update_stack(self, stack_identifier, template, environment=None,
files=None):
env = environment or {}
env_files = files or {}
stack_name = stack_identifier.split('/')[0]
self.client.stacks.update(
stack_id=stack_identifier,
stack_name=stack_name,
template=template,
files=env_files,
disable_rollback=True,
parameters={},
environment=env
)
self._wait_for_stack_status(stack_identifier, 'UPDATE_COMPLETE')
def list_resources(self, stack_identifier):
resources = self.client.resources.list(stack_identifier)
return dict((r.resource_name, r.resource_type) for r in resources)
def test_stack_update_nochange(self):
stack_name = self._stack_rand_name()
self.client.stacks.create(