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

Add Decorator Support

This commit is contained in:
Kevin McCarthy
2013-12-15 16:43:11 -10:00
parent 0d08157e5d
commit 144d25bc66
4 changed files with 30 additions and 3 deletions

View File

@@ -114,3 +114,17 @@ def test_cross_scheme(tmpdir):
urllib2.urlopen('http://httpbin.org/')
assert len(cass) == 2
assert cass.play_count == 0
def test_decorator(scheme, tmpdir):
'''Test the decorator version of VCR.py'''
url = scheme + '://httpbin.org/'
@vcr.use_cassette(str(tmpdir.join('atts.yaml')))
def inner1():
return urllib2.urlopen(url).getcode()
@vcr.use_cassette(str(tmpdir.join('atts.yaml')))
def inner2():
return urllib2.urlopen(url).getcode()
assert inner1() == inner2()