betamaxHTTP 交互模拟库
Betamax 是 VCR 的模仿,用于 HTTP 请求。使用方法:
from betamax import Betamax from requests import Session from unittest import TestCase with Betamax.configure() as config: config.cassette_library_dir = 'tests/fixtures/cassettes' class TestGitHubAPI(TestCase): def setUp(self): self.session = Session() self.headers.update(...) # Set the cassette in a line other than the context declaration def test_user(self): with Betamax(self.session) as vcr: vcr.use_cassette('user') resp = self.session.get('https://api.github.com/user', auth=('user', 'pass')) assert resp.json()['login'] is not None # Set the cassette in line with the context declaration def test_repo(self): with Betamax(self.session).use_cassette('repo'): resp = self.session.get( 'https://api.github.com/repos/sigmavirus24/github3.py' ) assert resp.json()['owner'] != {}
评论
betamaxHTTP 交互模拟库
Betamax是VCR的模仿,用于HTTP请求。使用方法:from betamax import Betamaxfrom requests import Sessionfrom unittest im
betamaxHTTP 交互模拟库
0
VCRHTTP 交互模拟库
VCR是Ruby开发的一个用于简化HTTP交互测试的工具包。示例代码:require 'rubygems'require 'test/unit'require 'vcr'VCR.configure d
VCRHTTP 交互模拟库
0
VCR.pyHTTP 交互模拟库
VCR.py可自动化的模拟你的HTTP交互来简化和加速测试。VCR.py是Ruby版本的VCR的Python移植版本。使用方法:import vcrimport urllib2with vcr.use
VCR.pyHTTP 交互模拟库
0
SockJSWebSocket 模拟库
SockJS是一个浏览器上运行的JavaScript库,如果浏览器不支持WebSocket,该库可以模拟对WebSocket的支持,实现浏览器和Web服务器之间低延迟、全双工、跨域的通讯通道。Sock
SockJSWebSocket 模拟库
0
Elastomer-ClientElasticsearch 的交互库
Elastomer-Client为 ElasticSearchAPIendpoint提供一个一对一的映射。API通过你想要实现的来分解为逻辑部分和访问,每一个逻辑部分代表一个客户端类。示例代码:req
Elastomer-ClientElasticsearch 的交互库
0