summaryrefslogtreecommitdiff
path: root/tests/order_with_respect_to
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2019-01-21 14:00:18 -0500
committerTim Graham <timograham@gmail.com>2019-01-21 17:02:15 -0500
commit2110b1792422a8c358795c895d63fb75df51af9a (patch)
tree7ec0b74a9fa6402f4503516a6a42341164aa2fac /tests/order_with_respect_to
parent130192b12b63357a8f5ff448cd0edfa5a8094909 (diff)
downloaddjango-2110b1792422a8c358795c895d63fb75df51af9a.tar.gz
Tested Model.set_FOO_order() with an unrelated object.
Diffstat (limited to 'tests/order_with_respect_to')
-rw-r--r--tests/order_with_respect_to/base_tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/order_with_respect_to/base_tests.py b/tests/order_with_respect_to/base_tests.py
index 94f3c579e2..be67b068de 100644
--- a/tests/order_with_respect_to/base_tests.py
+++ b/tests/order_with_respect_to/base_tests.py
@@ -50,6 +50,13 @@ class BaseOrderWithRespectToTests:
a2 = self.Answer.objects.create(text="Number five", question=self.q1)
self.assertEqual(list(a1.question.get_answer_order()), list(a2.question.get_answer_order()))
+ def test_set_order_unrelated_object(self):
+ """An answer that's not related isn't updated."""
+ q = self.Question.objects.create(text='other')
+ a = self.Answer.objects.create(text='Number five', question=q)
+ self.q1.set_answer_order([o.pk for o in self.q1.answer_set.all()] + [a.pk])
+ self.assertEqual(self.Answer.objects.get(pk=a.pk)._order, 0)
+
def test_change_ordering(self):
# The ordering can be altered
a = self.Answer.objects.create(text="Number five", question=self.q1)