0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00
django/tests/migrations/test_loader.py

30 lines
804 B
Python

from django.test import TestCase
from django.db import connection
from django.db.migrations.recorder import MigrationRecorder
class RecorderTests(TestCase):
"""
Tests the disk and database loader.
"""
def test_apply(self):
"""
Tests marking migrations as applied/unapplied.
"""
recorder = MigrationRecorder(connection)
self.assertEqual(
recorder.applied_migrations(),
set(),
)
recorder.record_applied("myapp", "0432_ponies")
self.assertEqual(
recorder.applied_migrations(),
set([("myapp", "0432_ponies")]),
)
recorder.record_unapplied("myapp", "0432_ponies")
self.assertEqual(
recorder.applied_migrations(),
set(),
)