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

@ -200,7 +200,11 @@ class ListViewTests(TestCase):
self.assertTemplateUsed(res, 'generic_views/author_list.html')
def test_missing_items(self):
with self.assertRaises(ImproperlyConfigured):
msg = (
'AuthorList is missing a QuerySet. Define AuthorList.model, '
'AuthorList.queryset, or override AuthorList.get_queryset().'
)
with self.assertRaisesMessage(ImproperlyConfigured, msg):
self.client.get('/list/authors/invalid/')
def test_paginated_list_view_does_not_load_entire_table(self):