diff options
| author | Simon Charette <charette.s@gmail.com> | 2015-11-13 18:21:07 -0500 |
|---|---|---|
| committer | Simon Charette <charette.s@gmail.com> | 2015-11-14 11:33:28 -0500 |
| commit | d95b22bd56764c71047ec16f628c00c0fd997cfd (patch) | |
| tree | 6ce8395cb5a36c9f39a9c8ab842e44c1153f0a47 /tests/postgres_tests/test_array.py | |
| parent | 64240263f22055cb539159e9359e64d5096f39d9 (diff) | |
Refs #25745 -- Isolated some postgres array field check tests.
Diffstat (limited to 'tests/postgres_tests/test_array.py')
| -rw-r--r-- | tests/postgres_tests/test_array.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index b5a594592d..f5047755a7 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -4,6 +4,7 @@ import unittest import uuid from django import forms +from django.apps.registry import Apps from django.core import exceptions, serializers, validators from django.core.management import call_command from django.db import IntegrityError, connection, models @@ -328,18 +329,28 @@ class TestOtherTypesExactQuerying(PostgreSQLTestCase): class TestChecks(PostgreSQLTestCase): def test_field_checks(self): + test_apps = Apps(['postgres_tests']) + class MyModel(PostgreSQLModel): field = ArrayField(models.CharField()) + class Meta: + apps = test_apps + model = MyModel() errors = model.check() self.assertEqual(len(errors), 1) self.assertEqual(errors[0].id, 'postgres.E001') def test_invalid_base_fields(self): + test_apps = Apps(['postgres_tests']) + class MyModel(PostgreSQLModel): field = ArrayField(models.ManyToManyField('postgres_tests.IntegerArrayModel')) + class Meta: + apps = test_apps + model = MyModel() errors = model.check() self.assertEqual(len(errors), 1) |
