summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-09-10 18:30:35 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-09-10 18:30:35 +0200
commitbce7236a37cccea72790593744210ad3c7e161c6 (patch)
tree44ca7de0d9902db82a44e61ab3a42a0ca41d07ec
parent0c185f1abbe9abe0d977e1b7d1d3f0440b8d6371 (diff)
downloadIshtar-bce7236a37cccea72790593744210ad3c7e161c6.tar.bz2
Ishtar-bce7236a37cccea72790593744210ad3c7e161c6.zip
Test lock on operations
-rw-r--r--archaeological_operations/tests.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index 51dd1c346..9fa17b5f9 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -1597,6 +1597,44 @@ class OperationTest(TestCase, OperationInitTest):
self.assertEqual(c_index + 2, doc2.index)
+class LockTest(TestCase, OperationInitTest):
+ fixtures = FILE_FIXTURES
+
+ def setUp(self):
+ IshtarSiteProfile.objects.get_or_create(
+ slug='default', active=True)
+ self.username, self.password, self.user = create_superuser()
+ self.orgas = self.create_orgas(self.user)
+ self.operations = self.create_operation(self.user, self.orgas[0])
+ self.client = Client()
+ self.client.login(username=self.username, password=self.password)
+
+ self.operation = self.operations[0]
+ self.operation.locked = True
+ self.operation.save()
+
+ def test_wizard_lock(self):
+ cls_wiz = OperationWizardModifTest
+ url = reverse(cls_wiz.url_name)
+ # first wizard step
+ step = 'selec-operation_modification'
+ response = cls_wiz.wizard_post(
+ self.client, url, step, {'pk': self.operation.pk})
+ self.assertIn("locked for edition", response.content.decode(),
+ msg="wizard lock for edition not effective")
+
+ def test_qa_lock(self):
+ url = reverse('operation-qa-bulk-update', args=[self.operation.pk])
+ response = self.client.get(url)
+ self.assertRedirects(response, reverse('qa-not-available'))
+
+ def test_sheet_lock(self):
+ url = reverse('show-operation', kwargs={'pk': self.operation.pk})
+ response = self.client.get(url)
+ self.assertIn('This item has been locked', response.content.decode(),
+ msg="lock not displayed on sheet")
+
+
class CustomFormTest(TestCase, OperationInitTest):
fixtures = FILE_FIXTURES