def test_response(self): response_json = { "text": "Здравствуйте! Это мы, хороводоведы.", "tts": "Здравствуйте! Это мы, хоров+одо в+еды.", "buttons": [ { "title": "Надпись на кнопке", "payload": {}, "url": "https://responseexample.com/", "hide": True } ], "end_session": False } response = types.Response(**response_json) self._test_response(response, response_json) resp_text = 'Response Text' response = types.Response(resp_text, buttons=['Hi!']) self.assertEqual( response.to_json(), { 'text': resp_text, 'tts': None, 'buttons': [ { 'title': 'Hi!', 'url': None, 'payload': None, 'hide': True } ], 'end_session': False } )
def test_response2(self): response = types.Response(RESPONSE2['text'], buttons=['Hi!']) self._assert_payload(response, RESPONSE2)
def test_response1(self): response = types.Response(**RESPONSE) self._test_response(response, RESPONSE)