summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormick <michael@maithu.com>2015-06-05 15:58:36 +0100
committermick <michael@maithu.com>2015-06-10 10:20:51 +0100
commit211c19c579a8f285f666f405a0081b1080ec7622 (patch)
treec5adc6566d2695895860378dbb641f8ef9dc9487 /tests
parentc91bc68e9a5f9f1e2cce00d01d62d16a858155f0 (diff)
Fix for ticket 12685
Diffstat (limited to 'tests')
-rw-r--r--tests/serializers/tests.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/serializers/tests.py b/tests/serializers/tests.py
index c223fc4036..f9b65cba82 100644
--- a/tests/serializers/tests.py
+++ b/tests/serializers/tests.py
@@ -11,7 +11,7 @@ from xml.dom import minidom
from django.core import management, serializers
from django.db import connection, transaction
from django.test import (
- SimpleTestCase, TestCase, TransactionTestCase, override_settings,
+ SimpleTestCase, TestCase, TransactionTestCase, mock, override_settings,
skipUnlessDBFeature,
)
from django.test.utils import Approximate
@@ -278,6 +278,14 @@ class SerializersTestBase(object):
'second_category_pk': categories[1],
})
+ def test_deserialize_force_insert(self):
+ """Tests that deserialized content can be saved with force_insert as a parameter."""
+ serial_str = serializers.serialize(self.serializer_name, [self.a1])
+ deserial_obj = list(serializers.deserialize(self.serializer_name, serial_str))[0]
+ with mock.patch('django.db.models.Model') as mock_model:
+ deserial_obj.save(force_insert=False)
+ mock_model.save_base.assert_called_with(deserial_obj.object, raw=True, using=None, force_insert=False)
+
class SerializersTransactionTestBase(object):