mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 09:13:23 +00:00
Format with line length 110 to match flake8 make black part of linting check Update travis spec for updated black requirements Add diff output for black on failure update changelog
21 lines
886 B
Python
21 lines
886 B
Python
import pytest
|
|
import vcr
|
|
from six.moves.urllib.request import urlopen
|
|
|
|
|
|
def test_making_extra_request_raises_exception(tmpdir, httpbin):
|
|
# make two requests in the first request that are considered
|
|
# identical (since the match is based on method)
|
|
with vcr.use_cassette(str(tmpdir.join("test.json")), match_on=["method"]):
|
|
urlopen(httpbin.url + "/status/200")
|
|
urlopen(httpbin.url + "/status/201")
|
|
|
|
# Now, try to make three requests. The first two should return the
|
|
# correct status codes in order, and the third should raise an
|
|
# exception.
|
|
with vcr.use_cassette(str(tmpdir.join("test.json")), match_on=["method"]):
|
|
assert urlopen(httpbin.url + "/status/200").getcode() == 200
|
|
assert urlopen(httpbin.url + "/status/201").getcode() == 201
|
|
with pytest.raises(Exception):
|
|
urlopen(httpbin.url + "/status/200")
|