mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 09:13:23 +00:00
Fix httplib2 compatibility with py37
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
'''Integration tests with httplib2'''
|
'''Integration tests with httplib2'''
|
||||||
|
|
||||||
# External imports
|
import sys
|
||||||
|
|
||||||
from six.moves.urllib_parse import urlencode
|
from six.moves.urllib_parse import urlencode
|
||||||
import pytest
|
import pytest
|
||||||
import pytest_httpbin.certs
|
import pytest_httpbin.certs
|
||||||
|
|
||||||
# Internal imports
|
|
||||||
import vcr
|
import vcr
|
||||||
|
|
||||||
from assertions import assert_cassette_has_one_response
|
from assertions import assert_cassette_has_one_response
|
||||||
@@ -19,7 +19,12 @@ def http():
|
|||||||
Returns an httplib2 HTTP instance
|
Returns an httplib2 HTTP instance
|
||||||
with the certificate replaced by the httpbin one.
|
with the certificate replaced by the httpbin one.
|
||||||
"""
|
"""
|
||||||
return httplib2.Http(ca_certs=pytest_httpbin.certs.where())
|
kwargs = {
|
||||||
|
'ca_certs': pytest_httpbin.certs.where()
|
||||||
|
}
|
||||||
|
if sys.version_info[:2] == (3, 7):
|
||||||
|
kwargs['disable_ssl_certificate_validation'] = True
|
||||||
|
return httplib2.Http(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
def test_response_code(tmpdir, httpbin_both):
|
def test_response_code(tmpdir, httpbin_both):
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class VCRHTTPSConnectionWithTimeout(VCRHTTPSConnection,
|
|||||||
'timeout',
|
'timeout',
|
||||||
'source_address',
|
'source_address',
|
||||||
'ca_certs',
|
'ca_certs',
|
||||||
|
'disable_ssl_certificate_validation',
|
||||||
}
|
}
|
||||||
unknown_keys = set(kwargs.keys()) - safe_keys
|
unknown_keys = set(kwargs.keys()) - safe_keys
|
||||||
safe_kwargs = kwargs.copy()
|
safe_kwargs = kwargs.copy()
|
||||||
|
|||||||
Reference in New Issue
Block a user