diff options
Diffstat (limited to 'archaeological_finds/tests.py')
| -rw-r--r-- | archaeological_finds/tests.py | 72 | 
1 files changed, 72 insertions, 0 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 813153318..59ea1c199 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -1152,6 +1152,12 @@ class FindSearchTest(FindInit, TestCase, SearchText):          User.objects.create_superuser(self.username, "myemail@test.com", self.password)          self.client = Client() + +    def loggedIn_Client(): +        c = Client() +        return c.login(username=self.username, password=self.password) + +      def test_material_type_hierarchic_search(self):          find = self.finds[0]          c = Client() @@ -1276,6 +1282,72 @@ class FindSearchTest(FindInit, TestCase, SearchText):          ]          self._test_search(c, result, context="Text period search") +    def test_operator_search(self): +        operation = self.operations[0] +        operator = Organization.objects.create( +            name="My Orga", +            organization_type=OrganizationType.objects.all[0] +        ) +        operation.operator = operator +        operation.save() + +        c = Client() +        c.login(username=self.username, password=self.password) + +        key = str(pgettext_lazy("key for text search", "operator")) +        result = [ +            ('{}="{}"'.format(key, "My Orga"), 2) +        ] +        self._test_search(c, result, context="Text operator search") + + +    def test_common_name_operation_search(self): +        operation = self.operations[0] +        operation.common_name = "Operation Common Name" +        operation.save() + +        c = Client() +        c.login(username=self.username, password=self.password) + +        key = str(pgettext_lazy("key for text search", "operation-name")) +        result = [ +            ('{}="{}"'.format(key, "Operation Common Name"), 1) +        ] +        self._test_search(c, result, context="Text Operation Common Name Search") + + +    def test_address_operation_search(self): +        operation = self.operation[0] +        operation.address = "Street somewhere \n 29478 NOWHERE" +        operation.save() + +        c = Client() +        c.login(username=self.username, password=self.password) + +        key = str(pgettext_lazy("key for text search", "address")) +        result = [ +            ('{}="{}"'.format(key, "Street somewhere \n 29478 NOWHERE"), 1) +        ] +        self._test_search(c, result, context="Text Operation Address Search") + + +    def test_person_in_charge_search(self): +        operation = self.get_default_operationmodify +        operation.in_charge = Person.objects.create( +            raw_name="HISNAME Michel" +        ) +        operation.save() + +        c = Client() +        c.login(username=self.username, self.password) + +        key = str(pgettext_lazy("key for text search", "person-in-charge")) +        result = [ +            ('{}="{}"'.format(key, "HISNAME Michel"), 1) +        ] +        self._test_search(c, result, context= "Text Person In Charge Search") + +      def test_conservatory_state_hierarchic_search(self):          find = self.finds[0]          c = Client()  | 
