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 | efdc83d806b06c03a5789b3ebaed177f593ca4e5 (patch) | |
tree | f603c879b5e7d4a82d9602cbdb5143056af01747 /archaeological_context_records/tests.py | |
parent | b1f4a23679de9a561ed8ec3be9b79e851873bc0f (diff) | |
download | Ishtar-efdc83d806b06c03a5789b3ebaed177f593ca4e5.tar.bz2 Ishtar-efdc83d806b06c03a5789b3ebaed177f593ca4e5.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 |