]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat tests : convert functional test to testcase class
authorSteven Hardy <shardy@redhat.com>
Wed, 5 Sep 2012 13:20:19 +0000 (14:20 +0100)
committerSteven Hardy <shardy@redhat.com>
Wed, 5 Sep 2012 13:20:19 +0000 (14:20 +0100)
Covert test_WordPress_Single_Instance to be nose unittest.TestCase
subclass, so run_tests.sh outputs a more informative test identifier

Change-Id: I19fe8565d99253cabcbc93d2f003c69d953be615
Signed-off-by: Steven Hardy <shardy@redhat.com>
heat/tests/functional/test_WordPress_Single_Instance.py

index b8ba741c9981516ceab02778e40ee8a0245a240e..c3f57c43037cbea754895fb065fe897719e1c702 100644 (file)
@@ -16,38 +16,39 @@ import util
 import verify
 import nose
 from nose.plugins.attrib import attr
+import unittest
 
 
 @attr(speed='slow')
 @attr(tag=['func', 'wordpress'])
-def test_template():
-    try:
+class WordPressFunctionalTest(unittest.TestCase):
+    def setUp(self):
         template = 'WordPress_Single_Instance.template'
 
-        func_utils = util.FuncUtils()
+        self.func_utils = util.FuncUtils()
 
-        func_utils.prepare_jeos('F17', 'x86_64', 'cfntools')
-        func_utils.create_stack(template, 'F17')
-        func_utils.check_cfntools()
-        func_utils.wait_for_provisioning()
-        func_utils.check_user_data(template)
+        self.func_utils.prepare_jeos('F17', 'x86_64', 'cfntools')
+        self.func_utils.create_stack(template, 'F17')
+        self.func_utils.check_cfntools()
+        self.func_utils.wait_for_provisioning()
+        self.func_utils.check_user_data(template)
 
-        ssh = func_utils.get_ssh_client()
+        self.ssh = self.func_utils.get_ssh_client()
 
+    def test_instance(self):
         # ensure wordpress was installed by checking for expected
         # configuration file over ssh
         wp_file = '/etc/wordpress/wp-config.php'
-        stdin, stdout, sterr = ssh.exec_command('ls ' + wp_file)
+        stdin, stdout, sterr = self.ssh.exec_command('ls ' + wp_file)
         result = stdout.readlines().pop().rstrip()
         assert result == wp_file
         print "Wordpress installation detected"
 
         # Verify the output URL parses as expected, ie check that
         # the wordpress installation is operational
-        stack_url = func_utils.get_stack_output("WebsiteURL")
+        stack_url = self.func_utils.get_stack_output("WebsiteURL")
         print "Got stack output WebsiteURL=%s, verifying" % stack_url
         ver = verify.VerifyStack()
         assert True == ver.verify_wordpress(stack_url)
 
-    finally:
-        func_utils.cleanup()
+        self.func_utils.cleanup()