From: Veros Kaplan Date: Wed, 6 Nov 2013 12:26:46 +0000 (+0100) Subject: Added test: accessing two times same page X-Git-Tag: v0.4.0~4 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=16fa4f851d9aed43e59e1c43d60dc440244ee929;p=vcrpy.git Added test: accessing two times same page --- diff --git a/tests/integration/test_record_mode.py b/tests/integration/test_record_mode.py index 7217908..e3fdc8d 100644 --- a/tests/integration/test_record_mode.py +++ b/tests/integration/test_record_mode.py @@ -20,6 +20,17 @@ def test_once_record_mode(tmpdir): with pytest.raises(Exception): response = urllib2.urlopen('http://httpbin.org/get').read() +def test_once_record_mode_two_times(tmpdir): + testfile = str(tmpdir.join('recordmode.yml')) + with vcr.use_cassette(testfile, record_mode="once"): + # get two same files + response1 = urllib2.urlopen('http://httpbin.org/').read() + response2 = urllib2.urlopen('http://httpbin.org/').read() + + with vcr.use_cassette(testfile, record_mode="once") as cass: + # do it again + response = urllib2.urlopen('http://httpbin.org/').read() + response = urllib2.urlopen('http://httpbin.org/').read() def test_new_episodes_record_mode(tmpdir): testfile = str(tmpdir.join('recordmode.yml')) @@ -61,6 +72,7 @@ def test_all_record_mode(tmpdir): assert cass.play_count == 0 + def test_none_record_mode(tmpdir): # Cassette file doesn't exist, yet we are trying to make a request. # raise hell.