def test_model_base_error_handling_with_patch_and_with_nested_delete(self, patch_method, post_method, stream, session):
stream.feed_data(b'[{}]')
stream.feed_eof()
request = SwaggerRequest('/model1/1/', 'patch', body=stream, headers={'content-type': 'application/json'})
await post_method(request, session)
stream = asyncio.StreamReader(loop=session.loop)
body = {'model2_': {'id': 1, '_operation': 'delete'}}
stream.feed_data(ujson.dumps(body).encode())
stream.feed_eof()
request = SwaggerRequest('/model1/1/', 'patch', path_params={'id': 1}, body=stream, headers={'content-type': 'application/json'})
resp = await patch_method(request, session)
assert resp.status_code == 400
assert ujson.loads(resp.body) == {
'instance': [body],
'message': "Can't execute nested 'delete' operation"
}
评论列表
文章目录