diff options
-rw-r--r-- | archaeological_operations/tests.py | 38 |
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 |