diff options
| author | Simon Charette <charette.s@gmail.com> | 2015-12-04 13:14:12 -0500 |
|---|---|---|
| committer | Simon Charette <charette.s@gmail.com> | 2015-12-07 15:04:13 -0500 |
| commit | c0da598077ea475e65741abbba6993e4677fe501 (patch) | |
| tree | 4e7e90f7e033c899c63f0d782f62c25897666faf /tests | |
| parent | 0154702a987bd06d20e53fe23284b2c4a93b9063 (diff) | |
[1.9.x] Fixed #25867 -- Fixed a system check crash with nested ArrayFields.
Thanks to Jean Gourds for the report, Tim and Claude for the review.
Backport of 59b57e672c2f5a685804cce253d2c5314c45c5fa from master
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/postgres_tests/test_array.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index 0ff7198fc2..094a1e2235 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -347,7 +347,9 @@ class TestChecks(PostgreSQLTestCase): model = MyModel() errors = model.check() self.assertEqual(len(errors), 1) + # The inner CharField is missing a max_length. self.assertEqual(errors[0].id, 'postgres.E001') + self.assertIn('max_length', errors[0].msg) def test_invalid_base_fields(self): test_apps = Apps(['postgres_tests']) @@ -363,6 +365,25 @@ class TestChecks(PostgreSQLTestCase): self.assertEqual(len(errors), 1) self.assertEqual(errors[0].id, 'postgres.E002') + def test_nested_field_checks(self): + """ + Nested ArrayFields are permitted. + """ + test_apps = Apps(['postgres_tests']) + + class MyModel(PostgreSQLModel): + field = ArrayField(ArrayField(models.CharField())) + + class Meta: + apps = test_apps + + model = MyModel() + errors = model.check() + self.assertEqual(len(errors), 1) + # The inner CharField is missing a max_length. + self.assertEqual(errors[0].id, 'postgres.E001') + self.assertIn('max_length', errors[0].msg) + @unittest.skipUnless(connection.vendor == 'postgresql', "PostgreSQL specific tests") class TestMigrations(TransactionTestCase): |
