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

Fix Google test Failure

Let's not use Google to test redirects since it changes depending on your
geographic location.  I changed the test to use httpbin.org, since
a lot of our tests already depend on httpbin.org anyway.

Somedays, I'd like to implement my own local mock HTTP server I
can do asserts against.  The test suite would just start it up,
and the server would record the requests, which I could then
retrieve and compare.

Closes #21
This commit is contained in:
Kevin McCarthy
2013-08-18 12:04:22 -10:00
parent 4894cb7e22
commit 348cc8fdfe

View File

@@ -4,9 +4,9 @@ import vcr
def test_recorded_request_url_with_redirected_request(tmpdir):
with vcr.use_cassette(str(tmpdir.join('test.yml'))) as cass:
assert len(cass) == 0
urllib2.urlopen('http://google.com')
urllib2.urlopen('http://httpbin.org/redirect/3')
print cass.requests
print cass.requests[0]
assert cass.requests[0].url == 'http://google.com'
assert cass.requests[1].url == 'http://www.google.com/'
assert len(cass) == 2
assert cass.requests[0].url == 'http://httpbin.org/redirect/3'
assert cass.requests[3].url == 'http://httpbin.org/get'
assert len(cass) == 4