[rhmessaging-commits] rhmessaging commits: r2023 - mgmt/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Thu May 8 18:55:40 EDT 2008


Author: justi9
Date: 2008-05-08 18:55:40 -0400 (Thu, 08 May 2008)
New Revision: 2023

Modified:
   mgmt/cumin/python/cumin/test.py
Log:
Use more descriptive exception messages.

Remove printlns.



Modified: mgmt/cumin/python/cumin/test.py
===================================================================
--- mgmt/cumin/python/cumin/test.py	2008-05-08 22:43:41 UTC (rev 2022)
+++ mgmt/cumin/python/cumin/test.py	2008-05-08 22:55:40 UTC (rev 2023)
@@ -212,8 +212,6 @@
         redirect = p.get_redirect_url(s)
 
         if redirect is None:
-            print form.name_errors.get(s), form.addr_errors.get(s)
-
             raise Exception("Expected redirect")
 
         p, s = self.env.page_and_session()
@@ -222,9 +220,12 @@
         p.process(s)
         p.render(s)
 
-        self.env.broker_registration = BrokerRegistration.selectBy \
-            (name=session.id)[0]
-
+        try:
+            self.env.broker_registration = BrokerRegistration.selectBy \
+                (name=session.id)[0]
+        except IndexError:
+            raise Exception("Registration not created")
+            
         self.run_children(session)
 
     class AddToGroup(Test):
@@ -262,7 +263,7 @@
 
             try:
                 reg = BrokerRegistration.selectBy(name=session.id)[0]
-                raise Exception("Delete failed")
+                raise Exception("Registration not deleted")
             except IndexError:
                 pass
 
@@ -367,7 +368,11 @@
 
         wait(predicate)
 
-        self.env.vhost = Vhost.selectBy(broker=self.env.broker, name="/")[0]
+        try:
+            self.env.vhost = Vhost.selectBy \
+                (broker=self.env.broker, name="/")[0]
+        except IndexError:
+            raise Exception("Vhost not found")
 
         self.run_children(session)
 
@@ -382,10 +387,11 @@
 
         wait(predicate)
 
-        self.env.queue = Queue.selectBy(vhost=vhost, name=name)[0]
+        try:
+            self.env.queue = Queue.selectBy(vhost=vhost, name=name)[0]
+        except IndexError:
+            raise Exception("Queue not found")
 
-        print self.env.queue
-
         self.run_children(session)
 
 class ExchangeTest(Test):
@@ -393,10 +399,11 @@
         vhost = self.env.vhost
         name = self.env.broker_exchange.name
 
-        self.env.exchange = Exchange.selectBy(vhost=vhost, name=name)[0]
+        try:
+            self.env.exchange = Exchange.selectBy(vhost=vhost, name=name)[0]
+        except IndexError:
+            raise Exception("Exchange not found")
 
-        print self.env.exchange
-
         self.run_children(session)
 
 class ClientTest(Test):
@@ -407,10 +414,11 @@
         address = self.env.broker_conn.host + ":" + \
             str(self.env.broker_conn.port)
 
-        self.env.client = Client.selectBy(vhost=vhost, address=address)[0]
+        try:
+            self.env.client = Client.selectBy(vhost=vhost, address=address)[0]
+        except IndexError:
+            raise Exception("Client not found")
 
-        print self.env.client
-
         self.run_children(session)
 
 def wait(predicate, timeout=30):




More information about the rhmessaging-commits mailing list