diff options
author | Mads Jensen <mje@inducks.org> | 2017-05-28 21:37:21 +0200 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2017-07-29 19:07:23 -0400 |
commit | a51c4de1945be2225f20fad794cfb52d8f1f9236 (patch) | |
tree | 36386b70a27cf027a8a491de319c3e59e0d3d0cd /tests/reverse_lookup | |
parent | 38988f289f7f5708f5ea85de2d5dfe0d86b23106 (diff) | |
download | django-a51c4de1945be2225f20fad794cfb52d8f1f9236.tar.gz |
Used assertRaisesMessage() to test Django's error messages.
Diffstat (limited to 'tests/reverse_lookup')
-rw-r--r-- | tests/reverse_lookup/tests.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/reverse_lookup/tests.py b/tests/reverse_lookup/tests.py index 0e0093f38e..b73b23e932 100644 --- a/tests/reverse_lookup/tests.py +++ b/tests/reverse_lookup/tests.py @@ -46,5 +46,9 @@ class ReverseLookupTests(TestCase): """ If a related_name is given you can't use the field name instead """ - with self.assertRaises(FieldError): + msg = ( + "Cannot resolve keyword 'choice' into field. Choices are: " + "creator, creator_id, id, poll_choice, question, related_choice" + ) + with self.assertRaisesMessage(FieldError, msg): Poll.objects.get(choice__name__exact="This is the answer") |