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

Replaced 'url' mather with 'uri'.

This commit is contained in:
Max Shytikov
2014-04-11 01:32:10 +02:00
parent 7fe55ad8b8
commit 2fa1aaa1f7
6 changed files with 15 additions and 14 deletions

View File

@@ -25,18 +25,18 @@ def test_method_matcher(cassette):
urlopen('http://httpbin.org/post', data=b'') # is a POST request
def test_url_matcher(cassette):
def test_uri_matcher(cassette):
# prepare cassete
with vcr.use_cassette(cassette, match_on=['url']) as cass:
with vcr.use_cassette(cassette, match_on=['uri']) as cass:
urlopen('http://httpbin.org/get?p1=q1&p2=q2')
assert len(cass) == 1
# play cassette with matching on url
with vcr.use_cassette(cassette, match_on=['url']) as cass:
# play cassette with matching on uri
with vcr.use_cassette(cassette, match_on=['uri']) as cass:
urlopen('http://httpbin.org/get?p1=q1&p2=q2')
assert cass.play_count == 1
# should fail if url does not match
# should fail if uri does not match
with pytest.raises(vcr.errors.CannotOverwriteExistingCassetteException):
with vcr.use_cassette(cassette, match_on=['url']) as cass:
with vcr.use_cassette(cassette, match_on=['uri']) as cass:
urlopen('http://httpbin.org/get?p2=q2&p1=q1')