summaryrefslogtreecommitdiff
path: root/tests/basic/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basic/tests.py')
-rw-r--r--tests/basic/tests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/basic/tests.py b/tests/basic/tests.py
index ea9228376c..3c2d1dead9 100644
--- a/tests/basic/tests.py
+++ b/tests/basic/tests.py
@@ -20,6 +20,7 @@ from .models import (
ArticleSelectOnSave,
ChildPrimaryKeyWithDefault,
FeaturedArticle,
+ PrimaryKeyWithDbDefault,
PrimaryKeyWithDefault,
SelfRef,
)
@@ -175,6 +176,11 @@ class ModelInstanceCreationTests(TestCase):
with self.assertNumQueries(1):
PrimaryKeyWithDefault().save()
+ def test_save_primary_with_db_default(self):
+ # An UPDATE attempt is skipped when a primary key has db_default.
+ with self.assertNumQueries(1):
+ PrimaryKeyWithDbDefault().save()
+
def test_save_parent_primary_with_default(self):
# An UPDATE attempt is skipped when an inherited primary key has
# default.