summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-03-09 17:20:37 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-06-17 13:21:27 +0200
commitefdc83d806b06c03a5789b3ebaed177f593ca4e5 (patch)
treef603c879b5e7d4a82d9602cbdb5143056af01747 /archaeological_operations
parentb1f4a23679de9a561ed8ec3be9b79e851873bc0f (diff)
downloadIshtar-efdc83d806b06c03a5789b3ebaed177f593ca4e5.tar.bz2
Ishtar-efdc83d806b06c03a5789b3ebaed177f593ca4e5.zip
Autocomplete: small fix and general tests
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/tests.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index e1f29b293..7867116fb 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -52,7 +52,8 @@ from archaeological_context_records.models import Unit, ContextRecord
from ishtar_common import forms_common
from ishtar_common.tests import WizardTest, WizardTestFormData as FormData, \
- create_superuser, create_user, TestCase, OPERATION_FIXTURES
+ create_superuser, create_user, TestCase, OPERATION_FIXTURES, \
+ AutocompleteTestBase, AcItem
OPERATION_TOWNS_FIXTURES = \
@@ -2836,3 +2837,30 @@ class DocumentWizardDeleteTest(WizardTest, OperationInitTest, TestCase):
# operation not deleted with the document
self.assertEqual(models.Operation.objects.filter(
pk=self.ope_id).count(), 1)
+
+
+class AutocompleteTest(AutocompleteTestBase, TestCase):
+ fixtures = OPERATION_FIXTURES
+ models = [
+ AcItem(models.Operation, 'autocomplete-operation',
+ prepare_func="create_operation"),
+ AcItem(models.ArchaeologicalSite, 'autocomplete-archaeologicalsite',
+ "reference"),
+ AcItem(models.Operation, 'autocomplete-patriarche',
+ prepare_func="create_operation_patriarche",
+ id_key="code_patriarche", one_word_search=True),
+ ]
+
+ def create_operation(self, base_name):
+ item, __ = models.Operation.objects.get_or_create(
+ common_name=base_name,
+ operation_type=models.OperationType.objects.all()[0]
+ )
+ return item, None
+
+ def create_operation_patriarche(self, base_name):
+ item, __ = models.Operation.objects.get_or_create(
+ code_patriarche=base_name,
+ operation_type=models.OperationType.objects.all()[0]
+ )
+ return item, None