本文整理汇总了Python中vcr.cassette.Cassette.append方法的典型用法代码示例。如果您正苦于以下问题:Python Cassette.append方法的具体用法?Python Cassette.append怎么用?Python Cassette.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vcr.cassette.Cassette
的用法示例。
在下文中一共展示了Cassette.append方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_before_record_response
# 需要导入模块: from vcr.cassette import Cassette [as 别名]
# 或者: from vcr.cassette.Cassette import append [as 别名]
def test_before_record_response():
before_record_response = mock.Mock(return_value="mutated")
cassette = Cassette("test", before_record_response=before_record_response)
cassette.append("req", "res")
before_record_response.assert_called_once_with("res")
assert cassette.responses[0] == "mutated"
示例2: test_cassette_cant_read_same_request_twice
# 需要导入模块: from vcr.cassette import Cassette [as 别名]
# 或者: from vcr.cassette.Cassette import append [as 别名]
def test_cassette_cant_read_same_request_twice():
a = Cassette('test')
a.append('foo', 'bar')
a.play_response('foo')
with pytest.raises(UnhandledHTTPRequestError):
a.play_response('foo')
示例3: test_cassette_responses_of
# 需要导入模块: from vcr.cassette import Cassette [as 别名]
# 或者: from vcr.cassette.Cassette import append [as 别名]
def test_cassette_responses_of():
a = Cassette('test')
a.append('foo', 'bar')
assert a.responses_of('foo') == ['bar']
示例4: test_cassette_contains
# 需要导入模块: from vcr.cassette import Cassette [as 别名]
# 或者: from vcr.cassette.Cassette import append [as 别名]
def test_cassette_contains():
a = Cassette('test')
a.append('foo', 'bar')
assert 'foo' in a
示例5: test_cassette_len
# 需要导入模块: from vcr.cassette import Cassette [as 别名]
# 或者: from vcr.cassette.Cassette import append [as 别名]
def test_cassette_len():
a = Cassette('test')
a.append('foo', 'bar')
a.append('foo2', 'bar2')
assert len(a) == 2
示例6: test_cassette_append
# 需要导入模块: from vcr.cassette import Cassette [as 别名]
# 或者: from vcr.cassette.Cassette import append [as 别名]
def test_cassette_append():
a = Cassette('test')
a.append('foo', 'bar')
assert a.requests == ['foo']
assert a.responses == ['bar']
示例7: test_cassette_all_played
# 需要导入模块: from vcr.cassette import Cassette [as 别名]
# 或者: from vcr.cassette.Cassette import append [as 别名]
def test_cassette_all_played():
a = Cassette('test')
a.append('foo', 'bar')
a.play_response('foo')
assert a.all_played
示例8: test_cassette_not_all_played
# 需要导入模块: from vcr.cassette import Cassette [as 别名]
# 或者: from vcr.cassette.Cassette import append [as 别名]
def test_cassette_not_all_played():
a = Cassette('test')
a.append('foo', 'bar')
assert not a.all_played