assert content == (yield get(get_client(), url)).body
assert 1 == cass.play_count
+@pytest.mark.gen_test
+def test_effective_url(get_client, scheme, tmpdir):
+ '''Ensure that the effective_url is captured'''
+ url = scheme + '://httpbin.org/redirect-to?url=/html'
+ with vcr.use_cassette(str(tmpdir.join('url.yaml'))):
+ effective_url = (yield get(get_client(), url)).effective_url
+
+ with vcr.use_cassette(str(tmpdir.join('url.yaml'))) as cass:
+ assert effective_url == (yield get(get_client(), url)).effective_url
+ assert 1 == cass.play_count
@pytest.mark.gen_test
def test_auth(get_client, tmpdir, scheme):
reason=vcr_response['status']['message'],
headers=headers,
buffer=BytesIO(vcr_response['body']['string']),
+ effective_url=vcr_response.get('url'),
)
return callback(response)
else:
},
'headers': headers,
'body': {'string': response.body},
+ 'url': response.effective_url,
}
cassette.append(vcr_request, vcr_response)
return callback(response)