summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2020-01-31 01:38:48 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-02-07 11:03:53 +0100
commit71756bdfed5029bd14dce8cb3c5629efc4be55ac (patch)
tree39c223acc21fc3373882dc5a6f0d1f801543d9e9 /tests
parent430e796980799feb75901b9918245b6b0bff3f54 (diff)
downloaddjango-71756bdfed5029bd14dce8cb3c5629efc4be55ac.tar.gz
Fixed #31055 -- Made constraint checks support databases aware.
Diffstat (limited to 'tests')
-rw-r--r--tests/invalid_models_tests/test_models.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py
index ec2d345d5a..4d2a923a00 100644
--- a/tests/invalid_models_tests/test_models.py
+++ b/tests/invalid_models_tests/test_models.py
@@ -6,7 +6,7 @@ from django.core.checks.model_checks import _check_lazy_references
from django.db import connection, connections, models
from django.db.models.functions import Lower
from django.db.models.signals import post_init
-from django.test import SimpleTestCase
+from django.test import SimpleTestCase, TestCase
from django.test.utils import isolate_apps, override_settings, register_lookup
@@ -1212,7 +1212,7 @@ class OtherModelTests(SimpleTestCase):
@isolate_apps('invalid_models_tests')
-class ConstraintsTests(SimpleTestCase):
+class ConstraintsTests(TestCase):
def test_check_constraints(self):
class Model(models.Model):
age = models.IntegerField()
@@ -1220,7 +1220,7 @@ class ConstraintsTests(SimpleTestCase):
class Meta:
constraints = [models.CheckConstraint(check=models.Q(age__gte=18), name='is_adult')]
- errors = Model.check()
+ errors = Model.check(databases=self.databases)
warn = Warning(
'%s does not support check constraints.' % connection.display_name,
hint=(
@@ -1230,7 +1230,7 @@ class ConstraintsTests(SimpleTestCase):
obj=Model,
id='models.W027',
)
- expected = [] if connection.features.supports_table_check_constraints else [warn, warn]
+ expected = [] if connection.features.supports_table_check_constraints else [warn]
self.assertCountEqual(errors, expected)
def test_check_constraints_required_db_features(self):