期望匹配龙卷风请求和响应对象

tornado-expects的Python项目详细描述


Latest versionNumber of PyPI downloadshttps://secure.travis-ci.org/jaimegildesagredo/tornado-expects.svg?branch=master

tornado expects是Expects断言库的匹配器库。它为Tornado web framework请求和响应对象提供匹配器。

安装

您可以使用pipeasy_install安装pypi的最后一个稳定版本。

$ pip install tornado-expects

您还可以从github安装最新的源代码。

$ pip install -e git+git://github.com/jaimegildesagredo/tornado-expects.git#egg=tornado-expects

用法

只要导入expectcallable,tornado就需要匹配器,并开始为测试double编写断言。

fromexpectsimportexpectfromtornado_expectsimport*fromtornado.httpclientimportHTTPClientresponse=http_client.fetch('https://example.com')expect(response).to(be_ok)

匹配器

没事

expect(response).to(be_ok)expect(response).not_to(be_ok)

贝松

expect(response).to(be_json)expect(response).not_to(be_json)

标题

expect(response).to(have_header('Content-Type'))expect(response).to(have_header('Content-Type','text/xml'))expect(response).to(have_header('Content-Type',start_with('text/xml')))expect(response).not_to(have_header('ETag'))

有u头

expect(response).to(have_headers('Content-Type','Content-Length'))expect(response).to(have_headers({'Content-Type':'text/html'}))expect(response).not_to(have_headers('Etag','Authorization'))

状态

expect(response).to(have_status(304))expect(response).not_to(have_status(500))

规格

要运行规范,您应该安装测试需求,然后运行mamba

$ python setup.py develop
$ pip install -r test-requirements.txt
$ mamba

许可证

龙卷风预计在{a6}下释放。

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

推荐PyPI第三方库


热门话题
反射Java getMethod()会导致NoSuchMethodException错误   编译器构造Java编译时错误:解析时到达文件末尾   java我无法使用Spring Boot从应用程序引擎中的服务连接到Google数据存储   java单一注销配置文件Idp注销问题   regex如何在java中编写和使用正则表达式   java Android:单击标签打开电子邮件应用程序   java如何确保函数执行函数的整个检查?   java如何将字母数字电话号码转换为数字   listview更改中项目内部的java ImageView   java将空对象转换为整数   对等端重置java Google Drive SDk连接   在java程序中测试未授权的隐藏测试(代码战)