def test_items_post_invalid(self, init_db, headers, client):
client = await client
body = [{
'name': 'test',
'stores': [{'id': 1}],
'schema': {'properties': {'id': {'type': 'string'}}, 'type': 'object', 'id_names': ['id']}
}]
await client.post('/item_types/', headers=headers, data=ujson.dumps(body))
body = [{'id': 1}]
resp = await client.post('/item_types/1/items?store_id=1', headers=headers, data=ujson.dumps(body))
assert resp.status == 400
assert await resp.json() == {
'instance': 1,
'message': "1 is not of type 'string'. "\
"Failed validating instance['0']['id'] "\
"for schema['items']['properties']['id']['type']",
'schema': {'type': 'string'}
}
评论列表
文章目录