test_client.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:bothub-sdk-python 作者: bothub-studio 项目源码 文件源码
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}
        }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号