summaryrefslogtreecommitdiff
path: root/archaeological_operations/tests.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-10-29 17:50:49 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-02-19 14:43:49 +0100
commit547a20789faf6bbc9979357c7f65cbe61e56ed07 (patch)
tree5ede13492f49434468607950769266d643333d11 /archaeological_operations/tests.py
parentfcc0bb255730d43ec2cff78fb8b948d6322a8b68 (diff)
downloadIshtar-547a20789faf6bbc9979357c7f65cbe61e56ed07.tar.bz2
Ishtar-547a20789faf6bbc9979357c7f65cbe61e56ed07.zip
✨ permissions refactoring: link items to user QA forms
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r--archaeological_operations/tests.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index 18d927d06..41d4a8611 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -4784,6 +4784,30 @@ class OperationQATest(OperationInitTest, TestCase):
Permission.objects.get(codename="change_operation")
)
+ def test_link(self):
+ c = Client()
+ op0, op1 = self.operations[0], self.operations[1]
+ pks = "{}-{}".format(op0.pk, op1.pk)
+ url = reverse("operation-qa-link", args=[pks])
+
+ response = c.get(url)
+ self.assertEqual(response.status_code, 404)
+
+ c.login(username=self.username, password=self.password)
+ response = c.get(reverse("operation-qa-link", args=[pks]))
+
+ self.assertEqual(response.status_code, 200)
+ q_link = models.Operation.objects.filter(ishtar_users__pk__isnull=False)
+ self.assertEqual(q_link.count(), 0)
+
+ response = c.post(url, {"action": "link", "account": self.user.pk})
+ self.assertRedirects(response, "/success/")
+ self.assertEqual(q_link.count(), 2)
+
+ response = c.post(url, {"action": "unlink", "account": self.user.pk})
+ self.assertRedirects(response, "/success/")
+ self.assertEqual(q_link.count(), 0)
+
def test_lock(self):
c = Client()
op0, op1 = self.operations[0], self.operations[1]