Create common stack_create functional test helper

The same pattern for creating a stack, defaulting arguments,
setting cleanup, and waiting for status is repeated in all
tests, so move that logic to a common base-class helper.

Change-Id: Ibf4c2f61d1f1936816245178fd8cf794e347de8b
diff --git a/common/test.py b/common/test.py
index 143fae3..1278c86 100644
--- a/common/test.py
+++ b/common/test.py
@@ -324,3 +324,25 @@
     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 stack_create(self, stack_name=None, template=None, files=None,
+                     parameters=None, environment=None):
+        name = stack_name or self._stack_rand_name()
+        templ = template or self.template
+        templ_files = files or {}
+        params = parameters or {}
+        env = environment or {}
+        self.client.stacks.create(
+            stack_name=name,
+            template=templ,
+            files=templ_files,
+            disable_rollback=True,
+            parameters=params,
+            environment=env
+        )
+        self.addCleanup(self.client.stacks.delete, name)
+
+        stack = self.client.stacks.get(name)
+        stack_identifier = '%s/%s' % (name, stack.id)
+        self._wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')
+        return stack_identifier