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.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index 3da81a3bb..8eb2f361a 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -528,6 +528,7 @@ class ImportOperationTest(ImportTest, TestCase):
'4200-59350-YY55')
# cached_label update
ope2 = models.Operation.objects.get(code_patriarche='4201')
+ self.assertIsNotNone(ope2.cached_label)
self.assertIn('LILLE', ope2.cached_label.upper())
# delete associated parcel with the import deletion
parcel_count = models.Parcel.objects.count()
@@ -1178,6 +1179,7 @@ class OperationTest(TestCase, OperationInitTest):
def test_cache_update(self):
self.create_towns()
operation = self.operations[0]
+ self.assertIsNotNone(operation.cached_label)
town, ope_id = operation.cached_label.split(' | ')
self.assertIn(town, (u'Intercommunal', u"Multi-town"))
self.assertEqual(ope_id, 'OP2010-1')
@@ -1186,6 +1188,7 @@ class OperationTest(TestCase, OperationInitTest):
operation.save()
operation.towns.add(self.towns[0])
operation = models.Operation.objects.get(pk=operation.pk)
+ self.assertIsNotNone(operation.cached_label)
town, ope_id = operation.cached_label.split(' | ')
self.assertEqual(ope_id, 'OP2011-1')
self.assertEqual(town, self.towns[0].name)
@@ -1204,6 +1207,7 @@ class OperationTest(TestCase, OperationInitTest):
profile.save()
operation.code_patriarche = u"42HUIAAA5"
operation.save()
+ self.assertIsNotNone(operation.search_vector)
for key in (
'old', 'dirty', 'daisy', "'2010'", "zardoz", "huiaaa5",
"{}42huiaaa5".format(profile.operation_prefix.lower()),
@@ -1256,6 +1260,7 @@ class OperationTest(TestCase, OperationInitTest):
# verify the relevance of the update
cr = ContextRecord.objects.get(pk=cr.pk)
+ self.assertIsNotNone(cr.cached_label)
ope_id, parcel_sec, parcel_nb, cr_label = cr.cached_label.split(' | ')
profile = get_current_profile()
@@ -1266,6 +1271,7 @@ class OperationTest(TestCase, OperationInitTest):
op_code, idx = base_find.cache_short_id.split(' | ')
self.assertEqual(op_code, 'OP2011-1')
self.assertEqual(idx, '00001')
+ self.assertIsNotNone(base_find.cache_complete_id)
op_code, mat_code, lbl, idx = base_find.cache_complete_id.split(' | ')
self.assertEqual(op_code, 'OP2011-1')
self.assertEqual(mat_code, 'ADA')
@@ -1273,6 +1279,7 @@ class OperationTest(TestCase, OperationInitTest):
self.assertEqual(idx, '00001')
find = Find.objects.get(pk=find.pk)
+ self.assertIsNotNone(find.cached_label)
op_code_idx, lbl = find.cached_label.split(' | ')
self.assertEqual(op_code_idx, 'OP2011-1-00001')
self.assertEqual(lbl, 'Find me')
@@ -1281,17 +1288,21 @@ class OperationTest(TestCase, OperationInitTest):
operation.code_patriarche = '666'
operation.save()
cr = ContextRecord.objects.get(pk=cr.pk)
+ self.assertIsNotNone(cr.cached_label)
ope_id, parcel_sec, parcel_nb, cr_label = cr.cached_label.split(' | ')
self.assertEqual(ope_id, '{}666'.format(profile.operation_prefix))
base_find = BaseFind.objects.get(pk=base_find.pk)
+ self.assertIsNotNone(base_find.cache_short_id)
op_code, idx = base_find.cache_short_id.split(' | ')
self.assertEqual(op_code, 'OA666')
+ self.assertIsNotNone(base_find.cache_complete_id)
op_code, mat_code, lbl, idx = base_find.cache_complete_id.split(' | ')
self.assertEqual(op_code, 'OA666')
find = Find.objects.get(pk=find.pk)
+ self.assertIsNotNone(find.cached_label)
op_code_idx, lbl = find.cached_label.split(' | ')
self.assertEqual(op_code_idx, 'OA666-00001')
@@ -1435,6 +1446,7 @@ class OperationTest(TestCase, OperationInitTest):
"frog_number": 32303}
operation.save()
operation = models.Operation.objects.get(pk=operation.pk)
+ self.assertIsNotNone(operation.search_vector)
for key in ('marmott',):
self.assertIn(key, operation.search_vector)
for key in ('32303', 'red', 'Red'):