test_routes.py 文件源码

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

项目:genericclient-requests 作者: genericclient 项目源码 文件源码
def test_endpoint_detail_route(self):
        with responses.RequestsMock() as rsps:
            rsps.add_callback(
                responses.POST, MOCK_API_URL + '/users/2/notify',
                callback=request_callback,
                content_type='application/json',
            )

            response = generic_client.users(id=2).notify(unread=3)
            self.assertEqual(response.json(), {'unread': 3})

        with responses.RequestsMock() as rsps:
            rsps.add_callback(
                responses.GET, MOCK_API_URL + '/users/2/notify',
                callback=request_callback,
                content_type='application/json',
            )

            response = generic_client.users(_method='get', id=2).notify(unread=3)
            self.assertEqual(response.json(), {'unread': 3})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号