summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2019-07-30 16:21:05 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-07-30 16:32:13 +0200
commite3fc9af4abd65262f2d3bdced96b687b65be618a (patch)
treea136c11065b41a32796443a1954c5775accc2fc3 /tests
parentb2aad9ad4d35ee3bb448ba698b8c56bb972bdd8a (diff)
Refs #30593 -- Fixed introspection of check constraints columns on MariaDB.
Diffstat (limited to 'tests')
-rw-r--r--tests/backends/mysql/test_introspection.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/backends/mysql/test_introspection.py b/tests/backends/mysql/test_introspection.py
index 1b8fb94ed9..37fbcb1513 100644
--- a/tests/backends/mysql/test_introspection.py
+++ b/tests/backends/mysql/test_introspection.py
@@ -7,16 +7,23 @@ from django.test import TestCase
@skipUnless(connection.vendor == 'mysql', 'MySQL tests')
class ParsingTests(TestCase):
def test_parse_constraint_columns(self):
+ _parse_constraint_columns = connection.introspection._parse_constraint_columns
tests = (
- ('`height` >= 0', ['height']),
- ('`cost` BETWEEN 1 AND 10', ['cost']),
- ('`ref1` > `ref2`', ['ref1', 'ref2']),
+ ('`height` >= 0', ['height'], ['height']),
+ ('`cost` BETWEEN 1 AND 10', ['cost'], ['cost']),
+ ('`ref1` > `ref2`', ['id', 'ref1', 'ref2'], ['ref1', 'ref2']),
(
'`start` IS NULL OR `end` IS NULL OR `start` < `end`',
+ ['id', 'start', 'end'],
['start', 'end'],
),
+ ('JSON_VALID(`json_field`)', ['json_field'], ['json_field']),
+ ('CHAR_LENGTH(`name`) > 2', ['name'], ['name']),
+ ("lower(`ref1`) != 'test'", ['id', 'owe', 'ref1'], ['ref1']),
+ ("lower(`ref1`) != 'test'", ['id', 'lower', 'ref1'], ['ref1']),
+ ("`name` LIKE 'test%'", ['name'], ['name']),
)
- for check_clause, expected_columns in tests:
+ for check_clause, table_columns, expected_columns in tests:
with self.subTest(check_clause):
- check_columns = connection.introspection._parse_constraint_columns(check_clause)
+ check_columns = _parse_constraint_columns(check_clause, table_columns)
self.assertEqual(list(check_columns), expected_columns)