Lesson.order from the book (seed sets it, also re-syncs unit/node order); matrix lesson rows as one multi-line step
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,23 @@ class SeedContentTests(TestCase):
|
||||
self.assertEqual(question.choices.count(), 3)
|
||||
self.assertEqual(question.choices.get(is_correct=True).value, '۴')
|
||||
|
||||
def test_book_order_wins_over_creation_order(self):
|
||||
"""درسی که بعداً در وسطِ جزیره اضافه میشود id بزرگتر دارد؛ ترتیبِ نمایش باید ترتیبِ کتاب باشد،
|
||||
و ترتیبِ جابهجاشدهی فصل و جزیره هم با اجرای بعدیِ seed به کتاب برمیگردد."""
|
||||
call_command('seed_content')
|
||||
lessons = CURRICULUM['grades'][0]['units'][0]['nodes'][0]['lessons']
|
||||
lessons.insert(1, {'title': 'درسِ تازه در وسط', 'introText': 'x'})
|
||||
Unit.objects.update(order=99)
|
||||
Node.objects.update(order=99)
|
||||
self._write(CURRICULUM, QUESTIONS)
|
||||
call_command('seed_content')
|
||||
|
||||
node = Node.objects.get()
|
||||
self.assertEqual([l.title for l in node.lessons.all()],
|
||||
['ضرب توانها', 'درسِ تازه در وسط', 'تقسیم توانها'])
|
||||
self.assertEqual((Unit.objects.get().order, node.order), (4, 1))
|
||||
lessons.pop(1) # فایلِ مشترکِ تست را برای تستهای بعدی برمیگرداند
|
||||
|
||||
def test_second_run_changes_nothing(self):
|
||||
"""دیپلویِ دوم نباید چیزی را تکراری کند — این کلِ ایمنیِ خودکار بودنش است."""
|
||||
call_command('seed_content')
|
||||
|
||||
Reference in New Issue
Block a user