1
0
mirror of https://github.com/django/django.git synced 2025-10-25 14:46:09 +00:00

[1.7.x] Fixed #22487: Optional rollback emulation for migrated apps

Conflicts:
	django/db/backends/creation.py
	django/test/runner.py
	docs/ref/settings.txt
	docs/topics/testing/advanced.txt
This commit is contained in:
Andrew Godwin
2014-06-08 19:30:15 -07:00
parent bf019c9770
commit 08218252d8
17 changed files with 246 additions and 26 deletions

View File

@@ -0,0 +1,33 @@
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,
)