mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 01:03:24 +00:00
Make test use stream output to test MockStream interface
This commit is contained in:
@@ -95,13 +95,12 @@ def test_binary(tmpdir, scheme):
|
|||||||
|
|
||||||
def test_stream(tmpdir, scheme):
|
def test_stream(tmpdir, scheme):
|
||||||
url = scheme + '://httpbin.org/get'
|
url = scheme + '://httpbin.org/get'
|
||||||
headers = {'Content-Type': 'application/json'}
|
|
||||||
|
|
||||||
with vcr.use_cassette(str(tmpdir.join('stream.yaml'))):
|
with vcr.use_cassette(str(tmpdir.join('stream.yaml'))):
|
||||||
resp, body = get(url, output='raw') # XXX: headers?
|
resp, body = get(url, output='raw') # Do not use stream here, as the stream is exhausted by vcr
|
||||||
|
|
||||||
with vcr.use_cassette(str(tmpdir.join('stream.yaml'))) as cassette:
|
with vcr.use_cassette(str(tmpdir.join('stream.yaml'))) as cassette:
|
||||||
cassette_resp, cassette_body = get(url, output='raw')
|
cassette_resp, cassette_body = get(url, output='stream')
|
||||||
assert cassette_body == body
|
assert cassette_body == body
|
||||||
assert cassette.play_count == 1
|
assert cassette.play_count == 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user