summaryrefslogtreecommitdiff
path: root/archaeological_warehouse/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_warehouse/tests.py')
-rw-r--r--archaeological_warehouse/tests.py58
1 files changed, 51 insertions, 7 deletions
diff --git a/archaeological_warehouse/tests.py b/archaeological_warehouse/tests.py
index f4ce52732..938d1cbc0 100644
--- a/archaeological_warehouse/tests.py
+++ b/archaeological_warehouse/tests.py
@@ -56,7 +56,31 @@ class ContainerWizardCreationTest(WizardTest, FindInit, TestCase):
},
'localisation-container_creation': []
},
- )
+ ),
+ FormData(
+ 'Other container on the same warehouse',
+ form_datas={
+ 'container-container_creation': {
+ 'reference': 'hop-ref2',
+ 'container_type': None,
+ 'location': None,
+ 'responsible': None,
+ },
+ 'localisation-container_creation': []
+ },
+ ),
+ FormData(
+ 'Container creation with location',
+ form_datas={
+ 'container-container_creation': {
+ 'reference': 'hop-ref3',
+ 'container_type': None,
+ 'location': None,
+ 'responsible': None,
+ },
+ 'localisation-container_creation': []
+ },
+ ),
]
def pre_wizard(self):
@@ -64,17 +88,37 @@ class ContainerWizardCreationTest(WizardTest, FindInit, TestCase):
name="Main",
warehouse_type=models.WarehouseType.objects.all()[0]
)
- forms_data = self.form_datas[0].form_datas[
- 'container-container_creation']
- forms_data["responsible"] = main_warehouse.pk
- forms_data["location"] = main_warehouse.pk
- forms_data["container_type"] = models.ContainerType.objects.all()[0].pk
+ main_data = self.form_datas[0].form_datas
+ main_data_bis = self.form_datas[1].form_datas
+ alt_data = self.form_datas[2].form_datas
+ for data in [main_data, main_data_bis, alt_data]:
+ forms_data = data['container-container_creation']
+ forms_data["responsible"] = main_warehouse.pk
+ forms_data["location"] = main_warehouse.pk
+ forms_data["container_type"] = \
+ models.ContainerType.objects.all()[0].pk
+ alt_warehouse = models.Warehouse.objects.create(
+ name="Alt",
+ warehouse_type=models.WarehouseType.objects.all()[0]
+ )
+ div = models.WarehouseDivision.objects.create(label='division')
+ div_link = models.WarehouseDivisionLink.objects.create(
+ warehouse=alt_warehouse, division=div)
+ alt_data['container-container_creation']["location"] = alt_warehouse.pk
+ alt_data['localisation-container_creation'] = {
+ 'division_{}'.format(div_link.pk): 'Combien ?'
+ }
+
self.container_number = models.Container.objects.count()
+ self.localisation_detail_number = \
+ models.ContainerLocalisation.objects.count()
super(ContainerWizardCreationTest, self).pre_wizard()
def post_wizard(self):
self.assertEqual(models.Container.objects.count(),
- self.container_number + 1)
+ self.container_number + 3)
+ self.assertEqual(models.ContainerLocalisation.objects.count(),
+ self.localisation_detail_number + 1)
class ContainerTest(FindInit, TestCase):