]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
added a fix to httplib2
authorCharly <carlos_ds730@yahoo.es>
Wed, 4 Jan 2017 22:55:11 +0000 (17:55 -0500)
committerKevin McCarthy <me@kevinmccarthy.org>
Thu, 12 Jan 2017 03:54:15 +0000 (17:54 -1000)
tests/unit/test_stubs.py
vcr/stubs/__init__.py

index a3b7cca13a227dede95677ec26a88898de8a324f..7eb06840850f0757c82453e94b9cd249fc260c11 100644 (file)
@@ -1,4 +1,6 @@
 from vcr.stubs import VCRHTTPSConnection
+from vcr.compat import mock
+from vcr.cassette import Cassette
 
 
 class TestVCRConnection(object):
@@ -7,3 +9,10 @@ class TestVCRConnection(object):
         vcr_connection = VCRHTTPSConnection('www.examplehost.com')
         vcr_connection.ssl_version = 'example_ssl_version'
         assert vcr_connection.real_connection.ssl_version == 'example_ssl_version'
+
+    @mock.patch('vcr.cassette.Cassette.can_play_response_for', return_value=False)
+    def testing_connect(*args):
+        vcr_connection = VCRHTTPSConnection('www.google.com')
+        vcr_connection.cassette = Cassette('test', record_mode='all')
+        vcr_connection.real_connection.connect()
+        assert vcr_connection.real_connection.sock is not None
index a703ff43723de77f14ae2e154b659f0d2a26b9de..451824384f356e0b96c2b8bba6d89964c7dd2b53 100644 (file)
@@ -287,7 +287,9 @@ class VCRConnection(object):
             # Cassette is write-protected, don't actually connect
             return
 
-        return self.real_connection.connect(*args, **kwargs)
+        from vcr.patch import force_reset
+        with force_reset():
+            return self.real_connection.connect(*args, **kwargs)
 
     @property
     def sock(self):