summaryrefslogtreecommitdiff
path: root/tests/invalid_models_tests
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2019-08-10 02:41:18 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-08-12 06:44:37 +0200
commit8b3e1b6e9e4ee87fe85b2e5437faf59457e03e62 (patch)
treef2b55bc4805add78a494942135bf75c999033f39 /tests/invalid_models_tests
parent2fb872e56f064361c2cd4674c0f23cd419994d82 (diff)
Refs #11964 -- Made constraint support check respect required_db_features.
This will notably silence the warnings issued when running the test suite on MySQL.
Diffstat (limited to 'tests/invalid_models_tests')
-rw-r--r--tests/invalid_models_tests/test_models.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py
index 18a59c407d..0f1d1e4dc3 100644
--- a/tests/invalid_models_tests/test_models.py
+++ b/tests/invalid_models_tests/test_models.py
@@ -1191,3 +1191,13 @@ class ConstraintsTests(SimpleTestCase):
)
expected = [] if connection.features.supports_table_check_constraints else [warn, warn]
self.assertCountEqual(errors, expected)
+
+ def test_check_constraints_required_db_features(self):
+ class Model(models.Model):
+ age = models.IntegerField()
+
+ class Meta:
+ required_db_features = {'supports_table_check_constraints'}
+ constraints = [models.CheckConstraint(check=models.Q(age__gte=18), name='is_adult')]
+
+ self.assertEqual(Model.check(), [])