diff options
Diffstat (limited to 'archaeological_finds/tests.py')
| -rw-r--r-- | archaeological_finds/tests.py | 29 | 
1 files changed, 29 insertions, 0 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index c98da7951..60dcb5a5d 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -1367,6 +1367,35 @@ class FindSearchTest(FindInit, TestCase, SearchText):          User.objects.create_superuser(self.username, "myemail@test.com", self.password)          self.client = Client() +    def test_item_count(self): +        find_1 = self.finds[0] +        ope2 = self.create_operation(self.get_default_user())[-1] +        context_record2 = self.create_context_record({"operation": ope2})[-1] +        base_find_2 = self.create_finds(data_base={"context_record": context_record2})[1][-1] + +        c = Client() +        # no result when no authentication +        response = c.get(reverse("get-find"), {}) +        self.assertRedirects(response, "/") + +        c.login(username=self.username, password=self.password) + +        # classic search +        response = c.get(reverse("get-find"), {}) +        self.assertEqual(response.status_code, 200) +        content = response.content.decode() +        res = json.loads(content) +        self.assertEqual(res["recordsTotal"], len(self.finds)) + +        # add the base find of find_2 to find_1 - grouping or other like treatment +        find_1.base_finds.add(base_find_2) +        # on find search there is column with context record that duplicate the line +        response = c.get(reverse("get-find"), {}) +        self.assertEqual(response.status_code, 200) +        content = response.content.decode() +        res = json.loads(content) +        self.assertEqual(res["recordsTotal"], len(self.finds) + 1) +      def test_material_type_hierarchic_search(self):          find = self.finds[0]          c = Client()  | 
