|
@@ -4,11 +4,13 @@ strings and thus eliminates the need for operations such as iexact and other
|
|
|
modifiers to enforce use of an index.
|
|
|
"""
|
|
|
from django.db import IntegrityError
|
|
|
+from django.test.utils import modify_settings
|
|
|
|
|
|
from . import PostgreSQLTestCase
|
|
|
from .models import CITestModel
|
|
|
|
|
|
|
|
|
+@modify_settings(INSTALLED_APPS={'append': 'django.contrib.postgres'})
|
|
|
class CITextTestCase(PostgreSQLTestCase):
|
|
|
|
|
|
@classmethod
|
|
@@ -17,6 +19,7 @@ class CITextTestCase(PostgreSQLTestCase):
|
|
|
name='JoHn',
|
|
|
email='joHn@johN.com',
|
|
|
description='Average Joe named JoHn',
|
|
|
+ array_field=['JoE', 'jOhn'],
|
|
|
)
|
|
|
|
|
|
def test_equal_lowercase(self):
|
|
@@ -34,3 +37,8 @@ class CITextTestCase(PostgreSQLTestCase):
|
|
|
"""
|
|
|
with self.assertRaises(IntegrityError):
|
|
|
CITestModel.objects.create(name='John')
|
|
|
+
|
|
|
+ def test_array_field(self):
|
|
|
+ instance = CITestModel.objects.get()
|
|
|
+ self.assertEqual(instance.array_field, self.john.array_field)
|
|
|
+ self.assertTrue(CITestModel.objects.filter(array_field__contains=['joe']).exists())
|