diff options
Diffstat (limited to 'archaeological_finds/tests.py')
-rw-r--r-- | archaeological_finds/tests.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index b5096ae01..4153a79ad 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -17,6 +17,8 @@ # See the file COPYING for details. +import datetime + from django.conf import settings from django.core.files.uploadedfile import SimpleUploadedFile from django.test import TestCase @@ -24,6 +26,7 @@ from ishtar_common.models import ImporterType, IshtarUser, ImporterColumn,\ FormaterType, ImportTarget from ishtar_common.models import Person +from archaeological_context_records.models import ContextRecord from archaeological_finds import models, views from archaeological_warehouse.models import Warehouse, WarehouseType @@ -80,6 +83,56 @@ class FindInit(ContextRecordInit): self.base_find = [] +class AFindWizardCreationTest(WizardTest, FindInit, TestCase): + # TODO: first to be run because of strange init things... + fixtures = [settings.ROOT_PATH + + '../fixtures/initial_data.json', + settings.ROOT_PATH + + '../ishtar_common/fixtures/initial_data.json', + settings.ROOT_PATH + + '../archaeological_files/fixtures/initial_data.json', + settings.ROOT_PATH + + '../archaeological_operations/fixtures/initial_data-fr.json', + settings.ROOT_PATH + + '../archaeological_finds/fixtures/initial_data-fr.json', + settings.ROOT_PATH + + '../archaeological_warehouse/fixtures/initial_data-fr.json', + ] + url_name = 'find_creation' + wizard_name = 'find_wizard' + steps = views.find_creation_steps + form_datas = [ + FormData( + 'Find creation', + form_datas={ + 'selecrecord-find_creation': {'pk': 1}, + 'find-find_creation': { + 'label': 'hop', + 'checked': 'NC', + 'check_date': '2016-01-01' + }, + 'dating-find_creation': [] + }, + ) + ] + + def pre_wizard(self): + q = ContextRecord.objects.filter(pk=1) + if not q.count(): + cr = self.create_context_record()[0] + cr.pk = 1 + cr.save() + self.find_number = models.Find.objects.count() + self.basefind_number = models.BaseFind.objects.count() + super(AFindWizardCreationTest, self).pre_wizard() + + def post_wizard(self): + self.assertEqual(models.BaseFind.objects.count(), + self.basefind_number + 1) + self.assertEqual(models.Find.objects.count(), + self.find_number + 1) + + class ATreatmentWizardCreationTest(WizardTest, FindInit, TestCase): # TODO: first to be run because of strange init things... fixtures = [settings.ROOT_PATH + |