summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ff90858)
raw | patch | inline | side by side (parent: ff90858)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 29 Feb 2004 00:41:51 +0000 (00:41 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 29 Feb 2004 00:41:51 +0000 (00:41 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2129 57a73879-2fb5-44c3-a270-3262357dd7e2
test/test_actions.py | patch | blob | history |
diff --git a/test/test_actions.py b/test/test_actions.py
index ebf39dfc5ed727e92e1d999aeca43e022adfcfa3..65a86f4beda5af4b176c52db9e97b2d676b2b504 100755 (executable)
--- a/test/test_actions.py
+++ b/test/test_actions.py
from roundup import hyperdb\r
from roundup.date import Date, Interval\r
from roundup.cgi.actions import *\r
-from roundup.cgi.exceptions import Redirect, Unauthorised\r
+from roundup.cgi.exceptions import Redirect, Unauthorised, SeriousError\r
\r
class MockNull:\r
def __init__(self, **kwargs):\r
self.client.form = self.form\r
\r
class ShowActionTestCase(ActionTestCase):\r
- def assertRaisesMessage(self, exception, callable, message, *args, **kwargs):\r
+ _nocheck = "don't compare exception values (the exception is enough)"\r
+ def assertRaisesMessage(self, exception, callable, message, *args,\r
+ **kwargs):\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__'): excName = excClass.__name__\r
- else: excName = str(excClass)\r
+ if hasattr(excClass,'__name__'):\r
+ excName = excClass.__name__\r
+ else:\r
+ excName = str(excClass)\r
raise self.failureException, excName\r
\r
def testShowAction(self):\r
self.assertRaises(ValueError, action.handle)\r
\r
self.form.value.append(MiniFieldStorage('@type', 'issue'))\r
- self.assertRaisesMessage(Redirect, action.handle, 'BASE/issue')\r
+ self.assertRaisesMessage(SeriousError, action.handle, self._nocheck)\r
\r
self.form.value.append(MiniFieldStorage('@number', '1'))\r
self.assertRaisesMessage(Redirect, action.handle, 'BASE/issue1')\r
\r
+ def testShowActionNoType(self):\r
+ action = ShowAction(self.client)\r
+ self.assertRaises(ValueError, action.handle)\r
+ self.form.value.append(MiniFieldStorage('@number', '1'))\r
+ self.assertRaisesMessage(ValueError, action.handle,\r
+ 'No type specified')\r
+\r
class RetireActionTestCase(ActionTestCase):\r
def testRetireAction(self):\r
self.client.db.security.hasPermission = true\r