summaryrefslogtreecommitdiff
path: root/archaeological_operations/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r--archaeological_operations/tests.py71
1 files changed, 38 insertions, 33 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index dd294550e..80569fb1b 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -38,7 +38,8 @@ from ishtar_common.models import OrganizationType, Organization, \
ImporterType, IshtarUser, TargetKey, IshtarSiteProfile
from ishtar_common import forms_common
-from ishtar_common.tests import WizardTest, create_superuser, create_user
+from ishtar_common.tests import WizardTest, WizardTestFormData as FormData, \
+ create_superuser, create_user
class ImportOperationTest(TestCase):
@@ -668,20 +669,20 @@ class OperationWizardCreationTest(WizardTest, OperationInitTest, TestCase):
url_name = 'operation_creation'
wizard_name = 'operation_wizard'
steps = views.wizard_steps
- form_datas = [(
- # data
- {
+ form_datas = [
+ FormData(
+ "Create a preventive diag",
+ form_datas={
'general-operation_creation': {
'operation_type': 1, # preventive diag
'year': 2016}
- },
- # ignored
- ('filechoice-operation_creation',
- 'preventive-operation_creation',
- 'towns-operation_creation',
- 'parcels-operation_creation',
- )
- )]
+ },
+ ignored=('filechoice-operation_creation',
+ 'preventive-operation_creation',
+ 'towns-operation_creation',
+ 'parcels-operation_creation', )
+ )
+ ]
def pre_wizard(self):
self.operation_number = models.Operation.objects.count()
@@ -697,15 +698,20 @@ class OperationWizardClosingTest(OperationWizardCreationTest):
url_name = 'operation_closing'
wizard_name = 'operation_closing_wizard'
steps = views.operation_closing_steps
- form_datas = [[
- {
- 'selec-operation_closing': {'pk': None},
- 'date-operation_closing': {'end_date': '2016-01-01'},
- }, []]]
+ form_datas = [
+ FormData(
+ "Wizard closing test",
+ form_datas={
+ 'selec-operation_closing': {'pk': None},
+ 'date-operation_closing': {'end_date': '2016-01-01'},
+ }
+ )
+ ]
def pre_wizard(self):
self.ope = self.get_default_operation()
- self.form_datas[0][0]['selec-operation_closing']['pk'] = self.ope.pk
+ self.form_datas[0].form_datas['selec-operation_closing']['pk'] = \
+ self.ope.pk
self.assertTrue(self.ope.is_active())
super(OperationWizardClosingTest, self).pre_wizard()
@@ -714,7 +720,7 @@ class OperationWizardClosingTest(OperationWizardCreationTest):
self.assertFalse(ope.is_active())
self.assertEqual(
ope.closing()['date'].strftime('%Y-%d-%m'),
- self.form_datas[0][0]['date-operation_closing']['end_date'])
+ self.form_datas[0].form_datas['date-operation_closing']['end_date'])
class OperationAdminActWizardCreationTest(WizardTest, OperationInitTest,
@@ -730,25 +736,24 @@ class OperationAdminActWizardCreationTest(WizardTest, OperationInitTest,
url_name = 'operation_administrativeactop'
wizard_name = 'operation_administrative_act_wizard'
steps = views.administrativeactop_steps
- form_datas = [[
- # data
- {
- 'selec-operation_administrativeactop': {
- },
- 'administrativeact-operation_administrativeactop': {
- 'signature_date': str(datetime.date.today())
- }
- },
- # ignored
- []
- ]]
+ form_datas = [
+ FormData(
+ "Admin act creation",
+ form_datas={
+ 'selec-operation_administrativeactop': {
+ },
+ 'administrativeact-operation_administrativeactop': {
+ 'signature_date': str(datetime.date.today())
+ }
+ },
+ )
+ ]
def pre_wizard(self):
ope = self.get_default_operation()
-
self.number = models.AdministrativeAct.objects.count()
- data = self.form_datas[0][0]
+ data = self.form_datas[0].form_datas
data['selec-operation_administrativeactop']['pk'] = ope.pk
act = models.ActType.objects.filter(intented_to='O').all()[0].pk