summaryrefslogtreecommitdiff
path: root/archaeological_operations/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r--archaeological_operations/tests.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index d1c4892bf..a50681667 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -1259,6 +1259,26 @@ class OperationTest(TestCase, OperationInitTest):
self.assertIn('class="card sheet"', response.content)
self.assertNotIn(u"Marmotte".encode('utf-8'), response.content)
+ def test_json_search_vector_update(self):
+ operation = self.operations[0]
+ content_type = ContentType.objects.get_for_model(operation)
+ JsonDataField.objects.create(name=u"Nom de marmotte",
+ key='groundhog__name',
+ content_type=content_type,
+ search_index=True)
+ JsonDataField.objects.create(name=u"Numéro grenouille",
+ key='frog_number',
+ content_type=content_type)
+ operation = models.Operation.objects.get(pk=operation.pk)
+ operation.data = {"groundhog": {"name": u"La Marmotte héhé",
+ "color": u"Red"},
+ "frog_number": 32303}
+ operation.save()
+ for key in ('marmott',):
+ self.assertIn(key, operation.search_vector)
+ for key in ('32303', 'red', 'Red'):
+ self.assertNotIn(key, operation.search_vector)
+
class CustomFormTest(TestCase, OperationInitTest):
fixtures = FILE_FIXTURES