Browse Source

Lets test _get_exception_message

Rafał Pitoń 11 years ago
parent
commit
a3017a6726
1 changed files with 15 additions and 0 deletions
  1. 15 0
      misago/core/tests/test_exceptionhandler.py

+ 15 - 0
misago/core/tests/test_exceptionhandler.py

@@ -139,3 +139,18 @@ class HandlePermissionDeniedExceptionTests(TestCase):
             self.request, self.exception)
             self.request, self.exception)
         self.assertIn(self.exception_message, response.content)
         self.assertIn(self.exception_message, response.content)
         self.assertEqual(response.status_code, 403)
         self.assertEqual(response.status_code, 403)
+
+
+class GetExceptionMessageTests(TestCase):
+    def test_get_exception_message(self):
+        """_get_exception_message returns message for exception with one"""
+        message = "Fish's name Eric"
+        exception = Http404(message)
+        self.assertEqual(exceptionhandler._get_exception_message(exception),
+                         message)
+
+    def test_get_no exception_message(self):
+        """_get_exception_message returns None for exception without one"""
+        exception = Http404()
+        self.assertEqual(exceptionhandler._get_exception_message(exception),
+                         None)