Falcon API单元测试与Bravado的集成。

bravado-falcon的Python项目详细描述


https://snap-ci.com/butla/bravado-falcon/branch/master/build_imagehttps://coveralls.io/repos/butla/bravado-falcon/badge.svg?branch=master&service=githubhttps://requires.io/github/butla/bravado-falcon/requirements.svg?branch=master

Falcon API单元测试与Bravado的集成。用于测试应用程序的合同

您可以很容易地为其他基于框架的单元测试(例如Flask的)实现Bravado集成 关于这个密码。

这个库做的不多,但它实际上已经完成了功能(没有那么多功能 执行

未来可以改变的一件事是Falcon请求的模拟方式。 现在已经用pytest-falcon完成了,但是你 不必在测试中使用Pytest(但这很好,至少应该检查一下 它出来了)。

用法

frombravado.clientimportSwaggerClientfrombravado_falconimportFalconHttpClientapi=get_falcon_api()# get a falcon.APIswagger_spec=get_swagger_spec()# dict created by loading a YAML or JSON from a fileclient=SwaggerClient.from_spec(swagger_spec,http_client=FalconHttpClient(api))# "v1" is the first part of a path (e.g. "/v1/shopping/lists")# "getList" is the "operationId" element for an endpoint from Swagger# "id" is a path parameter (let's say from "/v1/shopping/lists/{id}")# See Bravado docs for more information.list_object=client.v1.getList(id='list-id').result()# now make assertions about the returned object

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java从Struts操作的钩子更改表单值(Liferay 6.2)   java如何改变Spring MVC处理url“点”字符的行为   Clojure中使用Java接口的问题   junit如何模拟comosDB azure java集成客户端?   运行函数时发生java错误   netbeans Java。jar文件和依赖项   Eclipse中文本字段中的java输入类型   在JAVA中,将集合变量从实时批处理运行时传递到调用批处理文件   java通过Bean验证API中的自定义消息管理异常   XML到json的转换,在Java中,同时保留数据类型   根据JAVA中的列名从Excel文件中获取单元格值   在AsyncTask的doInBackground中未调用java FirebaseMessagingService   java如何在数据库中插入一行?