diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-11-30 13:20:53 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-11-30 13:20:53 +0100 |
commit | 8b666443667f92e014d70a4247c7885375bba610 (patch) | |
tree | 7e216f7c036ae568407d46359dea361f2a641098 /archaeological_finds/tests.py | |
parent | 62cac0ec03a96d5f358148cf6dff2a21ccf20854 (diff) | |
download | Ishtar-8b666443667f92e014d70a4247c7885375bba610.tar.bz2 Ishtar-8b666443667f92e014d70a4247c7885375bba610.zip |
Simple treatment form. Treatment listing. (refs #3365)
Diffstat (limited to 'archaeological_finds/tests.py')
-rw-r--r-- | archaeological_finds/tests.py | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index a0a9f0a8a..fdced4bd4 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -23,12 +23,14 @@ from django.test import TestCase from ishtar_common.models import ImporterType, IshtarUser, ImporterColumn,\ FormaterType, ImportTarget -from archaeological_finds import models +from archaeological_finds import models, views +from archaeological_warehouse.models import Warehouse, WarehouseType from archaeological_context_records.tests import ImportContextRecordTest, \ ContextRecordInit from ishtar_common import forms_common +from ishtar_common.tests import WizardTest, WizardTestFormData as FormData class ImportFindTest(ImportContextRecordTest): @@ -216,3 +218,53 @@ class PackagingTest(FindInit, TestCase): self.assertNotIn( item, self.finds, msg="Other basket have not been upgraded after packaging") + + +class TreatmentWizardCreationTest(WizardTest, FindInit, TestCase): + 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 = 'treatment_creation' + wizard_name = 'treatment_wizard' + steps = views.treatment_wizard_steps + form_datas = [ + FormData( + 'Move treament', + form_datas={ + 'basetreatment-treatment_creation': { + 'treatment_type': 4, # move + 'person': 1, # doer + 'location': 1, # associated warehouse + }, + 'selecfind-treatment_creation': { + 'pk': 1 + } + }, + ignored=('resultfind-treatment_creation', + 'resultfinds-treatment_creation')) + ] + + def pre_wizard(self): + q = Warehouse.objects.filter(pk=1) + if not q.count(): + warehouse = Warehouse.objects.create( + name="default", warehouse_type=WarehouseType.objects.all()[0]) + warehouse.id = 1 + warehouse.save() + self.treatment_number = models.Treatment.objects.count() + super(TreatmentWizardCreationTest, self).pre_wizard() + + def post_wizard(self): + self.assertEqual(models.Treatment.objects.count(), + self.treatment_number + 1) + pass |