Exemple #1
0
    def test_getting_uuid_value(self):
        uuid = "15"
        self.user.message.uuid = {"chatId": uuid}
        uuid_items = {'value': '{{uuid.chatId}}'}
        uuid_filler = AvailableInfoFiller(uuid_items)

        result = uuid_filler.extract(None, self.user)
        self.assertEqual(result, uuid)
Exemple #2
0
    def test_getting_payload_parsed_value(self):
        data = [{
            "id": 1,
            "surname": "Иванов",
            "name": "Иван",
            "patronimic": "Иванович",
            "tn": "1258838",
            "short_oe": "Д/О 8623/0302",
            "id_oe": "12344321",
            "count_tmc": 10,
            "actual_mol": True,
            "email": "*****@*****.**",
            "uname": "IVANOV-II1",
            "position": "инженер"
        }, {
            "id": 2,
            "surname": "Сидоров",
            "name": "Сидр",
            "patronimic": "Сидорович",
            "tn": "1258838",
            "short_oe": "Д/О 8623/0302",
            "id_oe": "12345678",
            "count_tmc": 5,
            "actual_mol": True,
            "email": "*****@*****.**",
            "uname": "IVANOV-II1",
            "position": "инженер"
        }, {
            "id": 3,
            "surname": "Петров",
            "name": "Петр",
            "patronimic": "Петрович",
            "tn": "144264",
            "short_oe": "Д/О 8623/030233",
            "id_oe": "12345678",
            "count_tmc": 5,
            "actual_mol": True,
            "email": "*****@*****.**",
            "uname": "IVANOV-II1",
            "position": "инженер"
        }]
        payload_items = {'value': '{{payload.data|tojson}}', 'loader': 'json'}
        payload_filler = AvailableInfoFiller(payload_items)

        self.user.message.payload = {
            "error_code": 200,
            "error_text": "OK",
            "skip": 1,
            "top": 20,
            "total_count": 125,
            "cacheGuid": "FHGDDASDHDAKSGFLAK",
            "data": data
        }
        result = payload_filler.extract(None, self.user)
        self.assertEqual(result, data)
Exemple #3
0
 def test_filter(self):
     template = Mock()
     template.get_template = Mock(
         return_value=["payload.personInfo.identityCard"])
     self.user.parametrizer = MockParametrizer(self.user, {"filter": True})
     self.user.message.payload = {"personInfo": {"identityCard": "my_pass"}}
     self.user.descriptions = {"render_templates": template}
     payload_items = {'value': '{{filter}}'}
     filler = AvailableInfoFiller(payload_items)
     result = filler.extract(None, self.user)
     self.assertEqual("filter_out", result)
Exemple #4
0
    def test_getting_person_info_value(self):
        name = "Name!"
        surname = "Surname!"
        self.user.person_info.raw = Mock()
        self.user.person_info.raw.full_name = {
            "name": name,
            "surname": surname
        }
        person_info_items = {'value': '{{person_info.full_name.surname}}'}
        person_info_filler = AvailableInfoFiller(person_info_items)

        result = person_info_filler.extract(None, self.user)
        self.assertEqual(result, surname)
Exemple #5
0
 def setUpClass(cls):
     cls.address = "Address!"
     payload_items = {'value': '{{payload.sf_answer.address}}'}
     cls.payload_filler = AvailableInfoFiller(payload_items)