1
0
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:
Aymeric Augustin
2014-03-21 14:21:43 +01:00
parent 907ac64641
commit 0f9560855e
29 changed files with 78 additions and 1454 deletions

View File

@@ -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)