def test_invalid_request(test_client, loop):
app = web.Application(loop=loop)
app.router.add_post('/', hello)
app.router.add_get('/', hello)
client = await test_client(app)
resp = await client.get('/')
assert resp.status == 400
text = await resp.json()
assert 'Request is malformed' in text["error"]
resp = await client.post('/')
assert resp.status == 400
text = await resp.json()
assert 'Request is malformed' in text["error"]
resp = await client.post('/', data="123afasdf")
assert resp.status == 400
text = await resp.json()
assert 'Request is malformed' in text["error"]
test_aiohttp_validate.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录