diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2014-06-08 19:30:15 -0700 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2014-06-08 19:30:15 -0700 |
| commit | 8c12d51ea27479555e226894c50c83043211d71d (patch) | |
| tree | db1e1e462f3a9eaf56733fce6c87aabb1b498705 /tests/migration_test_data_persistence/tests.py | |
| parent | 8721adcbfbc0bba7fe8341605a4ab4dffd9774d6 (diff) | |
Fixed #22487: Optional rollback emulation for migrated apps
Diffstat (limited to 'tests/migration_test_data_persistence/tests.py')
| -rw-r--r-- | tests/migration_test_data_persistence/tests.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/migration_test_data_persistence/tests.py b/tests/migration_test_data_persistence/tests.py new file mode 100644 index 0000000000..1b89c17b8b --- /dev/null +++ b/tests/migration_test_data_persistence/tests.py @@ -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, + ) |
