Code

Use assertRaises instead of introducing _nocheck machinery into assertRaisesMessage.
authorjlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2>
Tue, 2 Mar 2004 12:23:16 +0000 (12:23 +0000)
committerjlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2>
Tue, 2 Mar 2004 12:23:16 +0000 (12:23 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2136 57a73879-2fb5-44c3-a270-3262357dd7e2

test/test_actions.py

index 65a86f4beda5af4b176c52db9e97b2d676b2b504..2e33429e15b4b99aced31d8bc0b4bae8a619eb75 100755 (executable)
@@ -38,14 +38,15 @@ class ActionTestCase(unittest.TestCase):
         self.client.form = self.form\r
 \r
 class ShowActionTestCase(ActionTestCase):\r
-    _nocheck = "don't compare exception values (the exception is enough)"\r
     def assertRaisesMessage(self, exception, callable, message, *args,\r
-            **kwargs):\r
+                            **kwargs):\r
+        """An extension of assertRaises, which also checks the exception\r
+        message. We need this because we rely on exception messages when\r
+        redirecting.\r
+        """\r
         try:\r
             callable(*args, **kwargs)\r
         except exception, msg:\r
-            if message is self._nocheck:\r
-                return\r
             self.assertEqual(str(msg), message)\r
         else:\r
             if hasattr(excClass,'__name__'):\r
@@ -61,7 +62,7 @@ class ShowActionTestCase(ActionTestCase):
         self.assertRaises(ValueError, action.handle)\r
 \r
         self.form.value.append(MiniFieldStorage('@type', 'issue'))\r
-        self.assertRaisesMessage(SeriousError, action.handle, self._nocheck)\r
+        self.assertRaises(SeriousError, action.handle)\r
 \r
         self.form.value.append(MiniFieldStorage('@number', '1'))\r
         self.assertRaisesMessage(Redirect, action.handle, 'BASE/issue1')\r