mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-08 16:53:23 +00:00
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
13 lines
466 B
Python
13 lines
466 B
Python
import urllib2
|
|
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://httpbin.org/redirect/3')
|
|
print cass.requests
|
|
print cass.requests[0]
|
|
assert cass.requests[0].url == 'http://httpbin.org/redirect/3'
|
|
assert cass.requests[3].url == 'http://httpbin.org/get'
|
|
assert len(cass) == 4
|