Cleaned up exception message checking in some tests.

This commit is contained in:
Jon Dufresne 2019-03-15 16:27:57 -07:00 committed by Tim Graham
parent 58ad030d05
commit 95b7699ffc
6 changed files with 15 additions and 9 deletions

View file

@ -997,8 +997,11 @@ class RequestURLconfTests(SimpleTestCase):
Test reversing an URL from the *default* URLconf from inside
a response middleware.
"""
message = "Reverse for 'outer' not found."
with self.assertRaisesMessage(NoReverseMatch, message):
msg = (
"Reverse for 'outer' not found. 'outer' is not a valid view "
"function or pattern name."
)
with self.assertRaisesMessage(NoReverseMatch, msg):
self.client.get('/second_test/')
@override_settings(
@ -1070,7 +1073,8 @@ class DefaultErrorHandlerTests(SimpleTestCase):
response = self.client.get('/test/')
self.assertEqual(response.status_code, 404)
with self.assertRaisesMessage(ValueError, "I don't think I'm getting good"):
msg = "I don't think I'm getting good value for this view"
with self.assertRaisesMessage(ValueError, msg):
self.client.get('/bad_view/')