1
0
mirror of https://github.com/django/django.git synced 2025-01-23 16:50:41 +00:00

34 lines
770 B
Python

from django.test import TransactionTestCase
from .models import Book
class MigrationDataPersistenceTestCase(TransactionTestCase):
"""
Tests that data loaded in migrations is available if we set
serialized_rollback = True.
"""
available_apps = ["migration_test_data_persistence"]
serialized_rollback = True
def test_persistence(self):
self.assertEqual(
Book.objects.count(),
1,
)
class MigrationDataNoPersistenceTestCase(TransactionTestCase):
"""
Tests the failure case
"""
available_apps = ["migration_test_data_persistence"]
serialized_rollback = False
def test_no_persistence(self):
self.assertEqual(
Book.objects.count(),
0,
)