diff options
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 |
commit | 5030a8ea149caa7c7c544bdc492aa276c79eae75 (patch) | |
tree | f603c879b5e7d4a82d9602cbdb5143056af01747 /archaeological_context_records/tests.py | |
parent | 17107d80e46987327741529fe07e6fccba27c302 (diff) | |
download | Ishtar-5030a8ea149caa7c7c544bdc492aa276c79eae75.tar.bz2 Ishtar-5030a8ea149caa7c7c544bdc492aa276c79eae75.zip |
Autocomplete: small fix and general tests
Diffstat (limited to 'archaeological_context_records/tests.py')
-rw-r--r-- | archaeological_context_records/tests.py | 21 |
1 files changed, 20 insertions, 1 deletions
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 |