Source

bloodhound-mq / t355 / t355_r1444754_trac_test_ticket_comments.diff

# HG changeset patch
# Parent 8469e855776f7019d7ccd671e5d0c6691d8450ae
BH Multiproduct #355 : Rewrite Trac test cases for ticket comments to run them against product environments

diff -r 8469e855776f bloodhound_multiproduct/tests/ticket/model.py
--- a/bloodhound_multiproduct/tests/ticket/model.py	Mon Feb 11 13:05:18 2013 +0000
+++ b/bloodhound_multiproduct/tests/ticket/model.py	Tue Feb 12 22:57:35 2013 -0500
@@ -47,6 +47,37 @@
         self.global_env.reset_db()
         self.env = self.global_env = None
 
+class ProductTicketCommentTestCase(MultiproductTestCase):
+
+    @property
+    def env(self):
+        env = getattr(self, '_env', None)
+        if env is None:
+            self.global_env = self._setup_test_env()
+            self._upgrade_mp(self.global_env)
+            self._setup_test_log(self.global_env)
+            self._load_product_from_data(self.global_env, self.default_product)
+            self._env = env = ProductEnvironment(
+                    self.global_env, self.default_product)
+            self._load_default_data(env)
+        return env
+
+    @env.setter
+    def env(self, value):
+        pass
+
+    def tearDown(self):
+        self.global_env.reset_db()
+        self._env = self.global_env = None
+
+class ProductTicketCommentEditTestCase(TicketCommentEditTestCase,
+        ProductTicketCommentTestCase):
+    pass
+
+class ProductTicketCommentDeleteTestCase(TicketCommentDeleteTestCase,
+        ProductTicketCommentTestCase):
+    pass
+
 class ProductEnumTestCase(EnumTestCase, MultiproductTestCase):
     def setUp(self):
         self._mp_setup()
@@ -116,8 +147,8 @@
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(ProductTicketTestCase, 'test'))
-#    suite.addTest(unittest.makeSuite(ProductTicketCommentEditTestCase, 'test'))
-#    suite.addTest(unittest.makeSuite(ProductTicketCommentDeleteTestCase, 'test'))
+    suite.addTest(unittest.makeSuite(ProductTicketCommentEditTestCase, 'test'))
+    suite.addTest(unittest.makeSuite(ProductTicketCommentDeleteTestCase, 'test'))
     suite.addTest(unittest.makeSuite(ProductEnumTestCase, 'test'))
     suite.addTest(unittest.makeSuite(ProductMilestoneTestCase, 'test'))
     suite.addTest(unittest.makeSuite(ProductComponentTestCase, 'test'))