summaryrefslogtreecommitdiff
path: root/archaeological_finds/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/tests.py')
-rw-r--r--archaeological_finds/tests.py54
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