简化编写http rest服务集成测试的库

http-test-client的Python项目详细描述


库以简化编写http rest服务集成测试。

允许使用自动资源清理来构建http rest客户端。

示例

fromhttp_test_clientimportClient,HttpTransport,RestResources,resourcesclassArticleResources(RestResources):defsearch(self,query):returnself._request('/search',method='POST',data={'query':query})classResource(RestResources.Resource):defpublish(self):returnself._request('/publish',method='POST')comments=resources('/comments')classMyClient(Client):users=resources('/users')articles=resources('/articles',ArticleResources)client=MyClient(HttpTransport('http://localhost:8888'))# managing resourcesclient.users.list()# => [{'id': '1', 'name': 'John'}, ...]client.users.create({'name':'Jane'})# => {'id': '2'}client.users['1'].get()# => {'id': '1', 'name': 'John'}client.users['1'].delete()# delete all resources that were created during this client sessionclient.cleanup()# custom actionclient.articles['123'].publish()# nested resourcesclient.articles['123'].comments.list()

安装

$ pip install http-test-client

要求

  • python>;=2.7和<;=3.6
  • requests>;=2.14
  • 六>;=1.10

许可证

麻省理工学院许可有关详细信息,请参阅捆绑的LICENSE文件

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

推荐PyPI第三方库


热门话题
java如何确保在ActivityfromStaticMethodNewInstance中创建片段   java什么是允许集合的线程安全列表实现。分类   java正则表达式,用于检查字符串是否为正自然数   java Selenium WebDriver getText()   JSF(AWS)下的java Springboot白标签错误页面   java禁用特定URL Spring的基本身份验证   字符串无法转换为int!如何在java上对扫描的整数求和?   java创建键值对象列表   java Gradle with TestNg:未找到任何测试   java在Spark之外加载Mllib模型   当值存在时,比较器Java树映射为键返回null   java如何在Travis上使用Maven构建RPM包?   使用socket上传安卓 Java文件,需要上传文件的百分比?   java同步两个水平滚动视图   java通过扫描仪读取日期类型的字段