mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Removed legacy transaction management per the deprecation timeline.
This commit is contained in:
@@ -272,16 +272,13 @@ class SerializersTransactionTestBase(object):
|
||||
Tests that objects ids can be referenced before they are
|
||||
defined in the serialization data.
|
||||
"""
|
||||
# The deserialization process needs to be contained
|
||||
# within a transaction in order to test forward reference
|
||||
# handling.
|
||||
transaction.enter_transaction_management()
|
||||
objs = serializers.deserialize(self.serializer_name, self.fwd_ref_str)
|
||||
with connection.constraint_checks_disabled():
|
||||
for obj in objs:
|
||||
obj.save()
|
||||
transaction.commit()
|
||||
transaction.leave_transaction_management()
|
||||
# The deserialization process needs to run in a transaction in order
|
||||
# to test forward reference handling.
|
||||
with transaction.atomic():
|
||||
objs = serializers.deserialize(self.serializer_name, self.fwd_ref_str)
|
||||
with connection.constraint_checks_disabled():
|
||||
for obj in objs:
|
||||
obj.save()
|
||||
|
||||
for model_cls in (Category, Author, Article):
|
||||
self.assertEqual(model_cls.objects.all().count(), 1)
|
||||
|
||||
Reference in New Issue
Block a user