From 5030a8ea149caa7c7c544bdc492aa276c79eae75 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sat, 9 Mar 2019 17:20:37 +0100 Subject: Autocomplete: small fix and general tests --- archaeological_context_records/tests.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'archaeological_context_records/tests.py') diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index cbb5e0775..32e97c730 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -38,7 +38,7 @@ from archaeological_operations import models as models_ope from archaeological_context_records import models from ishtar_common.tests import WizardTest, WizardTestFormData as FormData, \ - create_superuser, create_user, TestCase + create_superuser, create_user, TestCase, AutocompleteTestBase, AcItem from archaeological_context_records import views @@ -839,3 +839,22 @@ class ContextRecordWizardCreationTest(WizardTest, ContextRecordInit, TestCase): # identical datings, only one should be finaly save cr = models.ContextRecord.objects.order_by('-pk')[0] self.assertEqual(cr.datings.count(), 1) + + +class AutocompleteTest(AutocompleteTestBase, TestCase): + fixtures = CONTEXT_RECORD_FIXTURES + models = [ + AcItem(models.ContextRecord, 'autocomplete-contextrecord', + prepare_func="create_cr"), + ] + + def create_cr(self, base_name): + ope, __ = models_ope.Operation.objects.get_or_create( + common_name="Test", + operation_type=models_ope.OperationType.objects.all()[0] + ) + item, __ = models.ContextRecord.objects.get_or_create( + operation=ope, + label=base_name + ) + return item, None -- cgit v1.2.3