diff options
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r-- | archaeological_operations/tests.py | 30 |
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 |