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.py37
1 files changed, 36 insertions, 1 deletions
diff --git a/archaeological_warehouse/tests.py b/archaeological_warehouse/tests.py
index cca1478ee..efe38b4a3 100644
--- a/archaeological_warehouse/tests.py
+++ b/archaeological_warehouse/tests.py
@@ -24,7 +24,7 @@ from archaeological_finds.tests import FindInit
from ishtar_common.tests import WizardTest, WizardTestFormData as FormData
-from archaeological_warehouse import models, views
+from archaeological_warehouse import models, views, forms
class ContainerWizardCreationTest(WizardTest, FindInit, TestCase):
@@ -75,3 +75,38 @@ class ContainerWizardCreationTest(WizardTest, FindInit, TestCase):
def post_wizard(self):
self.assertEqual(models.Container.objects.count(),
self.container_number + 1)
+
+
+class ContainerFormCreationTest(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',
+ ]
+
+ def testFormCreation(self):
+ main_warehouse = models.Warehouse.objects.create(
+ name="Main",
+ warehouse_type=models.WarehouseType.objects.all()[0]
+ )
+ data = {
+ 'reference': 'hop-ref',
+ "responsible": main_warehouse.pk,
+ "location": main_warehouse.pk,
+ "container_type": models.ContainerType.objects.all()[0].pk
+ }
+ form = forms.ContainerForm(data=data)
+ self.assertTrue(form.is_valid())
+ self.container_number = models.Container.objects.count()
+ self.create_user()
+ form.save(self.user)
+ self.assertEqual(models.Container.objects.count(),
+ self.container_number + 1)