From e2c9d49a368b53850769b9da1c5ea2cd8cbb18b9 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 11 Dec 2019 12:09:02 +0100 Subject: History only for superuser --- archaeological_operations/tests.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'archaeological_operations') diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 9466257a4..672c06647 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -1517,6 +1517,28 @@ class OperationTest(TestCase, OperationInitTest): self.assertEqual(response.status_code, 200) self.assertIn(b'class="card sheet"', response.content) + def test_show_history(self): + operation = self.operations[-1] + c = Client() + + operation = models.Operation.objects.get(id=operation.id) + operation._force_history = True + operation.common_name = "hophop" + operation.history_modifier = self.user + operation.save() + + c.login(username=self.username, password=self.password) + response = c.get(reverse('show-operation', kwargs={'pk': operation.pk})) + self.assertEqual(response.status_code, 200) + self.assertIn(b'class="card sheet"', response.content) + self.assertIn(b'/show-historized-operation/', response.content) + + c.login(username=self.alt_username, password=self.alt_password) + response = c.get(reverse('show-operation', kwargs={'pk': operation.pk})) + self.assertEqual(response.status_code, 200) + self.assertIn(b'class="card sheet"', response.content) + self.assertNotIn(b'/show-historized-operation/', response.content) + def test_show_pdf(self): operation = self.operations[0] c = Client() -- cgit v1.2.3