mirror of
https://github.com/django/django.git
synced 2024-12-30 13:05:45 +00:00
32 lines
711 B
Python
32 lines
711 B
Python
from django.test import TestCase, TransactionTestCase
|
|
|
|
from .models import Book
|
|
|
|
|
|
class MigrationDataPersistenceTestCase(TransactionTestCase):
|
|
"""
|
|
Data loaded in migrations is available if
|
|
TransactionTestCase.serialized_rollback = True.
|
|
"""
|
|
|
|
available_apps = ["migration_test_data_persistence"]
|
|
serialized_rollback = True
|
|
|
|
def test_persistence(self):
|
|
self.assertEqual(
|
|
Book.objects.count(),
|
|
1,
|
|
)
|
|
|
|
|
|
class MigrationDataNormalPersistenceTestCase(TestCase):
|
|
"""
|
|
Data loaded in migrations is available on TestCase
|
|
"""
|
|
|
|
def test_persistence(self):
|
|
self.assertEqual(
|
|
Book.objects.count(),
|
|
1,
|
|
)
|