]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
Fix Google test Failure
authorKevin McCarthy <me@kevinmccarthy.org>
Sun, 18 Aug 2013 22:04:22 +0000 (12:04 -1000)
committerKevin McCarthy <me@kevinmccarthy.org>
Sun, 18 Aug 2013 22:09:18 +0000 (12:09 -1000)
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

tests/integration/test_request.py

index 1875a4de99c7a21b76f177d64bcbc096e61b8fb4..68385322131a9bd6c74e5a8de4be0f298441ebba 100644 (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