]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Change VerifyClass to have a generic verify_url method
authorJeff Peeler <jpeeler@redhat.com>
Wed, 12 Sep 2012 15:36:43 +0000 (11:36 -0400)
committerJeff Peeler <jpeeler@redhat.com>
Wed, 12 Sep 2012 17:38:47 +0000 (13:38 -0400)
Change-Id: I0e1298e7852e336d6271c4014b11935ac3ce6689
Signed-off-by: Jeff Peeler <jpeeler@redhat.com>
heat/tests/functional/verify.py

index f44b228809162263e612779ede4a7660ba4ff933..d9bc235fccf2d3d604cdb940576732ed90935279 100644 (file)
@@ -55,13 +55,7 @@ class VerifyStack:
     '''
 
     @VerifyRetry()
-    def verify_wordpress(self, url, timeout=VERIFY_TIMEOUT):
-        '''
-        Verify the url provided has a functional wordpress installation
-        for now we simply scrape the page and do a regex for an expected
-        string
-        '''
-        WORDPRESS_REGEX = "<p>Welcome to the famous five minute WordPress"
+    def verify_url(self, url, timeout, regex):
 
         print "Reading html from %s" % url
         try:
@@ -69,9 +63,24 @@ class VerifyStack:
         except:
             return False
 
-        matches = re.findall(WORDPRESS_REGEX, content)
+        matches = re.findall(regex, content)
         if len(matches):
-            print "VERIFY WORDPRESS : looks OK!"
+            print "VERIFY : looks OK!"
             return True
         else:
             return False
+
+    @VerifyRetry()
+    def verify_wordpress(self, url, timeout=VERIFY_TIMEOUT):
+        '''
+        Verify the url provided has a functional wordpress installation
+        for now we simply scrape the page and do a regex for an expected
+        string
+        '''
+        WORDPRESS_REGEX = "<p>Welcome to the famous five minute WordPress"
+
+        return self.verify_url(url, timeout, WORDPRESS_REGEX)
+
+    def verify_openshift(self, url, timeout=VERIFY_TIMEOUT):
+        OPENSHIFT_REGEX = "<title>Welcome to OpenShift</title>"
+        return self.verify_url(url, timeout, OPENSHIFT_REGEX)