diff options
Diffstat (limited to 'tests/test_utils')
| -rw-r--r-- | tests/test_utils/test_transactiontestcase.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_utils/test_transactiontestcase.py b/tests/test_utils/test_transactiontestcase.py new file mode 100644 index 0000000000..34588ddefd --- /dev/null +++ b/tests/test_utils/test_transactiontestcase.py @@ -0,0 +1,28 @@ +from django.test import TransactionTestCase, mock + + +class TestSerializedRollbackInhibitsPostMigrate(TransactionTestCase): + """ + TransactionTestCase._fixture_teardown() inhibits the post_migrate signal + for test classes with serialized_rollback=True. + """ + available_apps = ['test_utils'] + serialized_rollback = True + + def setUp(self): + # self.available_apps must be None to test the serialized_rollback + # condition. + self.available_apps = None + + def tearDown(self): + self.available_apps = ['test_utils'] + + @mock.patch('django.test.testcases.call_command') + def test(self, call_command): + # with a mocked call_command(), this doesn't have any effect. + self._fixture_teardown() + call_command.assert_called_with( + 'flush', interactive=False, allow_cascade=False, + reset_sequences=False, inhibit_post_migrate=True, + database='default', verbosity=0, + ) |
