summaryrefslogtreecommitdiff
path: root/tests/generic_relations
diff options
context:
space:
mode:
authorMads Jensen <mje@inducks.org>2017-05-28 21:37:21 +0200
committerTim Graham <timograham@gmail.com>2017-07-29 19:07:23 -0400
commita51c4de1945be2225f20fad794cfb52d8f1f9236 (patch)
tree36386b70a27cf027a8a491de319c3e59e0d3d0cd /tests/generic_relations
parent38988f289f7f5708f5ea85de2d5dfe0d86b23106 (diff)
downloaddjango-a51c4de1945be2225f20fad794cfb52d8f1f9236.tar.gz
Used assertRaisesMessage() to test Django's error messages.
Diffstat (limited to 'tests/generic_relations')
-rw-r--r--tests/generic_relations/tests.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/generic_relations/tests.py b/tests/generic_relations/tests.py
index 91bb616420..d3aa3b15f8 100644
--- a/tests/generic_relations/tests.py
+++ b/tests/generic_relations/tests.py
@@ -347,7 +347,12 @@ class GenericRelationsTests(TestCase):
def test_generic_relation_related_name_default(self):
# GenericRelation isn't usable from the reverse side by default.
- with self.assertRaises(FieldError):
+ msg = (
+ "Cannot resolve keyword 'vegetable' into field. Choices are: "
+ "animal, content_object, content_type, content_type_id, id, "
+ "manualpk, object_id, tag, valuabletaggeditem"
+ )
+ with self.assertRaisesMessage(FieldError, msg):
TaggedItem.objects.filter(vegetable__isnull=True)
def test_multiple_gfk(self):