diff options
Diffstat (limited to 'archaeological_finds/tests.py')
-rw-r--r-- | archaeological_finds/tests.py | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index a1410c5d9..18744ea3d 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -26,7 +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_context_records.models import Period from archaeological_finds import models, views from archaeological_warehouse.models import Warehouse, WarehouseType @@ -114,7 +114,13 @@ class AFindWizardCreationTest(WizardTest, FindInit, TestCase): 'checked': 'NC', 'check_date': '2016-01-01' }, - 'dating-find_creation': [] + 'dating-find_creation': [ + { + 'period': None, + 'start_date': '0', + 'end_date': '200', + } + ] }, ) ] @@ -124,6 +130,8 @@ class AFindWizardCreationTest(WizardTest, FindInit, TestCase): data={'parcel': self.create_parcel()[-1]}, force=True)[-1] self.form_datas[0].form_datas['selecrecord-find_creation']['pk'] = cr.pk + self.form_datas[0].form_datas['dating-find_creation'][0]['period'] = \ + Period.objects.all()[0].pk self.find_number = models.Find.objects.count() self.basefind_number = models.BaseFind.objects.count() super(AFindWizardCreationTest, self).pre_wizard() @@ -187,20 +195,27 @@ class ATreatmentWizardCreationTest(WizardTest, FindInit, TestCase): person = Person.objects.create(name="default") person.id = 1 person.save() - find, base_find = self.get_default_find(force=True) + self.find, base_find = self.get_default_find(force=True) self.form_datas[0].form_datas['selecfind-treatment_creation'][ - 'pk'] = find.pk + 'pk'] = self.find.pk self.form_datas[0].form_datas['selecfind-treatment_creation'][ - 'resulting_pk'] = find.pk + 'resulting_pk'] = self.find.pk self.treatment_number = models.Treatment.objects.count() super(ATreatmentWizardCreationTest, self).pre_wizard() def post_wizard(self): self.assertEqual(models.Treatment.objects.count(), self.treatment_number + 1) + treat = models.Treatment.objects.order_by('-pk').all()[0] + self.find = models.Find.objects.get(pk=self.find.pk) + self.assertEqual(models.Find.objects.filter( + upstream_treatment=treat).count(), 1) + self.assertEqual(self.find.downstream_treatment, + treat) class ImportFindTest(ImportContextRecordTest): + test_operations = False test_context_records = False fixtures = ImportContextRecordTest.fixtures + [ |