summaryrefslogtreecommitdiff
path: root/tests/test_utils/test_transactiontestcase.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_utils/test_transactiontestcase.py')
-rw-r--r--tests/test_utils/test_transactiontestcase.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/test_utils/test_transactiontestcase.py b/tests/test_utils/test_transactiontestcase.py
index 0032e2ee0c..12ef4c9a1c 100644
--- a/tests/test_utils/test_transactiontestcase.py
+++ b/tests/test_utils/test_transactiontestcase.py
@@ -4,7 +4,7 @@ from django.db import connections
from django.test import TestCase, TransactionTestCase, override_settings
from django.test.testcases import DatabaseOperationForbidden
-from .models import Car
+from .models import Car, Person
class TestSerializedRollbackInhibitsPostMigrate(TransactionTestCase):
@@ -68,3 +68,16 @@ class DisallowedDatabaseQueriesTests(TransactionTestCase):
)
with self.assertRaisesMessage(DatabaseOperationForbidden, message):
Car.objects.using("other").get()
+
+
+class FixtureAvailableInSetUpClassTest(TransactionTestCase):
+ available_apps = ["test_utils"]
+ fixtures = ["person.json"]
+
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.elvis = Person.objects.get(name="Elvis Presley")
+
+ def test_fixture_loaded_during_class_setup(self):
+ self.assertIsInstance(self.elvis, Person)