1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

Fixes #123. When attempting to replay the same request twice using record_mode="new_episodes", vcr.py raises UnhandledHTTPRequestError.

This commit is contained in:
Nithin Reddy
2014-11-20 19:07:21 -08:00
parent 9d52c3ed42
commit 5162d183e5
2 changed files with 18 additions and 2 deletions

View File

@@ -72,6 +72,21 @@ def test_new_episodes_record_mode(tmpdir):
assert len(cass.responses) == 2
def test_new_episodes_record_mode_two_times(tmpdir):
testfile = str(tmpdir.join('recordmode.yml'))
with vcr.use_cassette(testfile, record_mode="new_episodes"):
# cassette file doesn't exist, so create.
response1 = urlopen('http://httpbin.org/').read()
with vcr.use_cassette(testfile, record_mode="new_episodes") as cass:
# make the same request again
response = urlopen('http://httpbin.org/').read()
# in the "new_episodes" record mode, we can add the same request
# to the cassette without repercussions
response = urlopen('http://httpbin.org/').read()
def test_all_record_mode(tmpdir):
testfile = str(tmpdir.join('recordmode.yml'))