summaryrefslogtreecommitdiff
path: root/tests/serializers
diff options
context:
space:
mode:
authorAhmad A. Hussein <ahmadahussein0@gmail.com>2020-08-14 22:07:37 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-08-17 09:31:16 +0200
commit493b26bbfc9cc0ad223ece131741cba2312ced0f (patch)
tree0a3ac47beb49583e13a904983e90cd1c31c337d2 /tests/serializers
parent632ccffc49658de5348c51a8918719364be54f37 (diff)
downloaddjango-493b26bbfc9cc0ad223ece131741cba2312ced0f.tar.gz
Fixed #31888 -- Avoided module-level MySQL queries in tests.
Diffstat (limited to 'tests/serializers')
-rw-r--r--tests/serializers/test_data.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/tests/serializers/test_data.py b/tests/serializers/test_data.py
index 323cb13e82..9fbdd256fe 100644
--- a/tests/serializers/test_data.py
+++ b/tests/serializers/test_data.py
@@ -378,21 +378,20 @@ if connection.features.interprets_empty_strings_as_nulls:
data[2]._meta.get_field('data').empty_strings_allowed and
data[3] is None)]
-# Regression test for #8651 -- a FK to an object with PK of 0
-# This won't work on MySQL without the NO_AUTO_VALUE_ON_ZERO SQL mode since it
-# won't let you create an object with an autoincrement primary key of 0.
-if connection.features.allows_auto_pk_0:
- test_data.extend([
- (data_obj, 0, Anchor, "Anchor 0"),
- (fk_obj, 465, FKData, 0),
- ])
-
class SerializerDataTests(TestCase):
pass
def serializerTest(self, format):
+ # FK to an object with PK of 0. This won't work on MySQL without the
+ # NO_AUTO_VALUE_ON_ZERO SQL mode since it won't let you create an object
+ # with an autoincrement primary key of 0.
+ if connection.features.allows_auto_pk_0:
+ test_data.extend([
+ (data_obj, 0, Anchor, 'Anchor 0'),
+ (fk_obj, 465, FKData, 0),
+ ])
# Create all the objects defined in the test data
objects = []