Used assertRaisesMessage() to test Django's error messages.

This commit is contained in:
Mads Jensen 2017-05-28 21:37:21 +02:00 committed by Tim Graham
parent 38988f289f
commit a51c4de194
69 changed files with 448 additions and 173 deletions

View file

@ -273,7 +273,11 @@ class TemplateViewTest(SimpleTestCase):
"""
A template view must provide a template name.
"""
with self.assertRaises(ImproperlyConfigured):
msg = (
"TemplateResponseMixin requires either a definition of "
"'template_name' or an implementation of 'get_template_names()'"
)
with self.assertRaisesMessage(ImproperlyConfigured, msg):
self.client.get('/template/no_template/')
@require_jinja2