From 6d265fdc8707a636f5faaf362b2e3df8c1cb1f5c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 23 Dec 2022 16:28:29 +0100 Subject: Search result - export: export only selected --- archaeological_operations/tests.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'archaeological_operations') diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 7bc51539d..25a561b6f 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -2875,6 +2875,21 @@ class OperationSearchTest(TestCase, OperationInitTest, SearchText): result = json.loads(response.content.decode()) self.assertEqual(result["recordsTotal"], 3) + def test_search_selected(self): + c = Client() + ope1 = self.operations[0] + ope2 = self.operations[1] + response = c.get(reverse("get-operation"), {"selected_ids": ope1.pk}) + # no result when no authentication + self.assertTrue(not json.loads(response.content.decode())) + c.login(username=self.username, password=self.password) + response = c.get(reverse("get-operation"), {"selected_ids": ope1.pk}) + result = json.loads(response.content.decode()) + self.assertEqual(result["recordsTotal"], 1) + response = c.get(reverse("get-operation"), {"selected_ids": f"{ope1.pk}-{ope2.pk}"}) + result = json.loads(response.content.decode()) + self.assertEqual(result["recordsTotal"], 2) + def test_base_search_vector(self): c = Client() response = c.get(reverse("get-operation"), {"search_vector": "chaTEAU"}) -- cgit v1.2.3