test_types.py 文件源码

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

项目:sanic-openapi 作者: channelcat 项目源码 文件源码
def test_list_default():
    app = Sanic('test_get')

    app.blueprint(openapi_blueprint)

    @app.put('/test')
    @doc.consumes(doc.List(int, description="All the numbers"), location="body")
    def test(request):
        return json({"test": True})

    request, response = app.test_client.get('/openapi/spec.json')

    response_schema = json_loads(response.body.decode())
    parameter = response_schema['paths']['/test']['put']['parameters'][0]

    assert response.status == 200
    assert parameter['type'] == 'array'
    assert parameter['items']['type'] == 'integer'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号