def test_handle_message_should_add_channel_cmd_buff():
event = {'content': 'hi!',
'channel': 'mychannel',
'sender': {'id': 'abcd1234',
'name': 'myname'}}
context = {'channel': {'endpoint': 'http://localhost'}}
with requests_mock.mock() as m:
m.post('http://localhost/messages')
response = handle_message(event, context, Bot)
assert response['response'] is None
assert m.called
assert m.request_history[0].json() == {
'channel': None,
'receiver': None,
'message': 'hello, you said: hi!',
'event': event,
'extra': None,
'context': {'api_key': '', 'project_id': None}
}
评论列表
文章目录