mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Tested Model.set_FOO_order() with an unrelated object.
This commit is contained in:
parent
130192b12b
commit
2110b17924
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user