Пример #1
0
 def test_alice_response(self):
     alice_response_json = {
         "response": {
             "text": "Здравствуйте! Это мы, хороводоведы.",
             "tts": "Здравствуйте! Это мы, хоров+одо в+еды.",
             "end_session": False
         },
         "session": {
             "session_id": "2eac4854-fce721f3-b845abba-20d60",
             "message_id": 4,
             "user_id": "AC9WC3DF6FCE052E45A4566A48E6B7193774B84814CE49A922E163B8B29881DC"
         },
         "version": "1.0"
     }
     alice_response = types.AliceResponse(**alice_response_json)
     self._test_alice_response(alice_response, alice_response_json)
     alice_response_json["response"]["buttons"] = [
         {
             "title": "Надпись на кнопке",
             "payload": {},
             "url": "https://example.com/",
             "hide": True
         },
         {
             "title": "Надпись на кнопке1",
             "payload": {'key': 'value'},
             "url": "https://ya.com/",
             "hide": False
         },
     ]
     alice_response = types.AliceResponse(**alice_response_json)
     self.assertEqual(alice_response.to_json(), alice_response_json)
     self._test_alice_response(alice_response, alice_response_json)
Пример #2
0
 def test_alice_response(self):
     alice_response = types.AliceResponse(**ALICE_RESPONSE)
     self._test_alice_response(alice_response, ALICE_RESPONSE)
     alice_response = types.AliceResponse(**ALICE_RESPONSE_WITH_BUTTONS)
     self._assert_payload(alice_response, ALICE_RESPONSE_WITH_BUTTONS)
     self._test_alice_response(alice_response, ALICE_RESPONSE_WITH_BUTTONS)