mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-08 16:53:23 +00:00
Add Python 2.3 support
This commit also adds the 'six' dependency
This commit is contained in:
committed by
Kevin McCarthy
parent
2385176084
commit
a73da71159
@@ -1,5 +1,5 @@
|
||||
import urllib2
|
||||
import vcr
|
||||
from vcr._compat import urlopen
|
||||
|
||||
|
||||
def true_matcher(r1, r2):
|
||||
@@ -16,13 +16,13 @@ def test_registered_serializer_true_matcher(tmpdir):
|
||||
testfile = str(tmpdir.join('test.yml'))
|
||||
with my_vcr.use_cassette(testfile, match_on=['true']) as cass:
|
||||
# These 2 different urls are stored as the same request
|
||||
urllib2.urlopen('http://httpbin.org/')
|
||||
urllib2.urlopen('https://httpbin.org/get')
|
||||
urlopen('http://httpbin.org/')
|
||||
urlopen('https://httpbin.org/get')
|
||||
|
||||
with my_vcr.use_cassette(testfile, match_on=['true']) as cass:
|
||||
# I can get the response twice even though I only asked for it once
|
||||
urllib2.urlopen('http://httpbin.org/get')
|
||||
urllib2.urlopen('https://httpbin.org/get')
|
||||
urlopen('http://httpbin.org/get')
|
||||
urlopen('https://httpbin.org/get')
|
||||
|
||||
|
||||
def test_registered_serializer_false_matcher(tmpdir):
|
||||
@@ -31,6 +31,6 @@ def test_registered_serializer_false_matcher(tmpdir):
|
||||
testfile = str(tmpdir.join('test.yml'))
|
||||
with my_vcr.use_cassette(testfile, match_on=['false']) as cass:
|
||||
# These 2 different urls are stored as different requests
|
||||
urllib2.urlopen('http://httpbin.org/')
|
||||
urllib2.urlopen('https://httpbin.org/get')
|
||||
urlopen('http://httpbin.org/')
|
||||
urlopen('https://httpbin.org/get')
|
||||
assert len(cass) == 2
|
||||
|
||||
Reference in New Issue
Block a user