diff options
| author | John Moses <john.moses@cerner.com> | 2015-10-02 09:44:35 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-10-05 09:36:42 -0400 |
| commit | 2b6344e9447b5a62cb779b92b061b783bdef5f1c (patch) | |
| tree | a75d825d22034b176948d600a3da0992281a01af /tests | |
| parent | ea8e7fd989095c1444528c8b9808076985d5ea0a (diff) | |
Fixed #25037 -- Added request.user to the debug view.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/view_tests/tests/test_debug.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py index b4e7f9c7fa..590d75264f 100644 --- a/tests/view_tests/tests/test_debug.py +++ b/tests/view_tests/tests/test_debug.py @@ -36,6 +36,11 @@ if six.PY3: from .py3_test_debug import Py3ExceptionReporterTests # NOQA +class User(object): + def __str__(self): + return 'jacob' + + class CallableSettingWrapperTests(SimpleTestCase): """ Unittests for CallableSettingWrapper """ @@ -254,6 +259,7 @@ class ExceptionReporterTests(SimpleTestCase): "A simple exception report can be generated" try: request = self.rf.get('/test_view/') + request.user = User() raise ValueError("Can't find my keys") except ValueError: exc_type, exc_value, tb = sys.exc_info() @@ -263,6 +269,8 @@ class ExceptionReporterTests(SimpleTestCase): self.assertIn('<pre class="exception_value">Can't find my keys</pre>', html) self.assertIn('<th>Request Method:</th>', html) self.assertIn('<th>Request URL:</th>', html) + self.assertIn('<h3 id="user-info">USER</h3>', html) + self.assertIn('<p>jacob</p>', html) self.assertIn('<th>Exception Type:</th>', html) self.assertIn('<th>Exception Value:</th>', html) self.assertIn('<h2>Traceback ', html) @@ -281,6 +289,7 @@ class ExceptionReporterTests(SimpleTestCase): self.assertIn('<pre class="exception_value">Can't find my keys</pre>', html) self.assertNotIn('<th>Request Method:</th>', html) self.assertNotIn('<th>Request URL:</th>', html) + self.assertNotIn('<h3 id="user-info">USER</h3>', html) self.assertIn('<th>Exception Type:</th>', html) self.assertIn('<th>Exception Value:</th>', html) self.assertIn('<h2>Traceback ', html) @@ -455,6 +464,7 @@ class PlainTextReportTests(SimpleTestCase): "A simple exception report can be generated" try: request = self.rf.get('/test_view/') + request.user = User() raise ValueError("Can't find my keys") except ValueError: exc_type, exc_value, tb = sys.exc_info() @@ -464,6 +474,7 @@ class PlainTextReportTests(SimpleTestCase): self.assertIn("Can't find my keys", text) self.assertIn('Request Method:', text) self.assertIn('Request URL:', text) + self.assertIn('USER: jacob', text) self.assertIn('Exception Type:', text) self.assertIn('Exception Value:', text) self.assertIn('Traceback:', text) @@ -482,6 +493,7 @@ class PlainTextReportTests(SimpleTestCase): self.assertIn("Can't find my keys", text) self.assertNotIn('Request Method:', text) self.assertNotIn('Request URL:', text) + self.assertNotIn('USER:', text) self.assertIn('Exception Type:', text) self.assertIn('Exception Value:', text) self.assertIn('Traceback:', text) |
