]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
Add effective url test for httplib2
authorMaarten van Schaik <maarten@byte.nl>
Fri, 14 Aug 2015 10:37:34 +0000 (12:37 +0200)
committerMaarten van Schaik <maarten@byte.nl>
Fri, 14 Aug 2015 10:37:34 +0000 (12:37 +0200)
tests/integration/test_httplib2.py

index f3ab42c890c9555a6b720b466f2426588a8346e3..f830a062551fe93785048e9d29923e7aae2d756c 100644 (file)
@@ -56,6 +56,17 @@ def test_response_headers(scheme, tmpdir):
         resp, _ = httplib2.Http().request(url)
         assert set(headers) == set(resp.items())
 
+def test_effective_url(scheme, tmpdir):
+    '''Ensure that the effective_url is captured'''
+    url = scheme + '://httpbin.org/redirect-to?url=/html'
+    with vcr.use_cassette(str(tmpdir.join('headers.yaml'))) as cass:
+        resp, _ = httplib2.Http().request(url)
+        effective_url = resp['content-location']
+        assert effective_url == scheme + '://httpbin.org/html'
+
+    with vcr.use_cassette(str(tmpdir.join('headers.yaml'))) as cass:
+        resp, _ = httplib2.Http().request(url)
+        assert effective_url == resp['content-location']
 
 def test_multiple_requests(scheme, tmpdir):
     '''Ensure that we can cache multiple requests'''