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
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