diff options
author | Vincent Poulailleau <vpoulailleau@gmail.com> | 2018-01-15 13:03:13 +0100 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2018-01-17 10:58:05 -0500 |
commit | fcd431c6c3159a753f1cc0658cc4b25803ffccc1 (patch) | |
tree | 2f724d93bf418ba6f462f57577a55d11d34146e2 /tests/generic_views | |
parent | 27557a7a99ab1ad032c699dc01e114a5e6504b0a (diff) | |
download | django-fcd431c6c3159a753f1cc0658cc4b25803ffccc1.tar.gz |
Improved generic detail view error message for when pk or slug is missing.
Diffstat (limited to 'tests/generic_views')
-rw-r--r-- | tests/generic_views/test_dates.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/generic_views/test_dates.py b/tests/generic_views/test_dates.py index 054ec7d223..6a18e090e6 100644 --- a/tests/generic_views/test_dates.py +++ b/tests/generic_views/test_dates.py @@ -695,7 +695,11 @@ class DateDetailViewTests(TestDataMixin, TestCase): self.assertEqual(res.context['exception'], 'Date out of range') def test_invalid_url(self): - with self.assertRaises(AttributeError): + msg = ( + 'Generic detail view BookDetail must be called with either an ' + 'object pk or a slug in the URLconf.' + ) + with self.assertRaisesMessage(AttributeError, msg): self.client.get("/dates/books/2008/oct/01/nopk/") def test_get_object_custom_queryset(self): |