summaryrefslogtreecommitdiff
path: root/archaeological_operations/tests.py
diff options
context:
space:
mode:
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]