summaryrefslogtreecommitdiff
path: root/archaeological_operations/tests.py
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
commitac37cb399caf95c911f869a9541907863114bb0f (patch)
tree44ca7de0d9902db82a44e61ab3a42a0ca41d07ec /archaeological_operations/tests.py
parent05ed481007604079612aa4b0f1f3bb8d4d35a6e5 (diff)
downloadIshtar-ac37cb399caf95c911f869a9541907863114bb0f.tar.bz2
Ishtar-ac37cb399caf95c911f869a9541907863114bb0f.zip
Test lock on operations
Diffstat (limited to 'archaeological_operations/tests.py')
-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