From 8947f0fc5c1ec2d1a238351f419fe247b4f002c5 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Thu, 18 Sep 2014 17:03:13 -0700 Subject: [PATCH] Add failing test for session still being attached to cassette after context is gone. --- tests/integration/test_requests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/integration/test_requests.py b/tests/integration/test_requests.py index 3139ac5..e36da18 100644 --- a/tests/integration/test_requests.py +++ b/tests/integration/test_requests.py @@ -152,6 +152,18 @@ def test_https_with_cert_validation_disabled(tmpdir): requests.get('https://httpbin.org', verify=False) +def test_session_can_make_requests_after_requests_unpatched(tmpdir): + with vcr.use_cassette(str(tmpdir.join('test_session_after_unpatched.yaml'))): + session = requests.session() + session.get('http://httpbin.org/get') + + with vcr.use_cassette(str(tmpdir.join('test_session_after_unpatched.yaml'))): + session = requests.session() + session.get('http://httpbin.org/get') + + session.get('http://httpbin.org/status/200') + + def test_nested_context_managers_with_session_created_before_first_nesting(scheme, tmpdir): ''' This tests ensures that a session that was created while one cassette was