summaryrefslogtreecommitdiff
path: root/tests/many_to_many
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/many_to_many
parent38988f289f7f5708f5ea85de2d5dfe0d86b23106 (diff)
downloaddjango-a51c4de1945be2225f20fad794cfb52d8f1f9236.tar.gz
Used assertRaisesMessage() to test Django's error messages.
Diffstat (limited to 'tests/many_to_many')
-rw-r--r--tests/many_to_many/tests.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/many_to_many/tests.py b/tests/many_to_many/tests.py
index d81d88b176..5b1c6e1516 100644
--- a/tests/many_to_many/tests.py
+++ b/tests/many_to_many/tests.py
@@ -29,7 +29,11 @@ class ManyToManyTests(TestCase):
# Create an Article.
a5 = Article(headline='Django lets you reate Web apps easily')
# You can't associate it with a Publication until it's been saved.
- with self.assertRaises(ValueError):
+ msg = (
+ '"<Article: Django lets you reate Web apps easily>" needs to have '
+ 'a value for field "id" before this many-to-many relationship can be used.'
+ )
+ with self.assertRaisesMessage(ValueError, msg):
getattr(a5, 'publications')
# Save it!
a5.save()