summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-07-30 20:50:09 -0400
committerTim Graham <timograham@gmail.com>2016-07-30 20:50:54 -0400
commit83b950e9ffd4904500bb9dcc9c7526f4d7899853 (patch)
tree72b298dd292ebf70541c384677861f1019b37477 /tests
parentc6e5878410ce7c1b26dd95c7ffb186dffba8acc2 (diff)
[1.10.x] Refs #25550 -- Corrected deprecation message for assigning M2M relations.
Backport of 5fa4370543658aedd79dc554d8c52684d6c7cbca from master
Diffstat (limited to 'tests')
-rw-r--r--tests/many_to_many/tests.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/many_to_many/tests.py b/tests/many_to_many/tests.py
index 67b3c9601e..86ffe816eb 100644
--- a/tests/many_to_many/tests.py
+++ b/tests/many_to_many/tests.py
@@ -400,15 +400,24 @@ class ManyToManyTests(TestCase):
self.a4.publications.set([], clear=True)
self.assertQuerysetEqual(self.a4.publications.all(), [])
- def test_assign_deprecation(self):
+ def test_assign_forward_deprecation(self):
msg = (
- "Direct assignment to the reverse side of a related set is "
+ "Direct assignment to the reverse side of a many-to-many set is "
"deprecated due to the implicit save() that happens. Use "
"article_set.set() instead."
)
with self.assertRaisesMessage(RemovedInDjango20Warning, msg):
self.p2.article_set = [self.a4, self.a3]
+ def test_assign_reverse_deprecation(self):
+ msg = (
+ "Direct assignment to the forward side of a many-to-many "
+ "set is deprecated due to the implicit save() that happens. Use "
+ "publications.set() instead."
+ )
+ with self.assertRaisesMessage(RemovedInDjango20Warning, msg):
+ self.a1.publications = [self.p1, self.p2]
+
@ignore_warnings(category=RemovedInDjango20Warning)
def test_assign_deprecated(self):
self.p2.article_set = [self.a4, self.a3]