mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-11 10:03:00 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5cfb005b48 | ||
|
|
4ade547779 | ||
|
|
dc8eedf555 | ||
|
|
5b9b6cd8b5 | ||
|
|
856c38479a | ||
|
|
52496cd091 | ||
|
|
bc26ce877a | ||
|
|
8db0d245a5 | ||
|
|
47544b08fe | ||
|
|
4e560fc8db |
@@ -9,6 +9,7 @@ env:
|
|||||||
- WITH_LIB="requests2.3"
|
- WITH_LIB="requests2.3"
|
||||||
- WITH_LIB="requests2.4"
|
- WITH_LIB="requests2.4"
|
||||||
- WITH_LIB="requests2.5"
|
- WITH_LIB="requests2.5"
|
||||||
|
- WITH_LIB="requests2.7"
|
||||||
- WITH_LIB="requests1.x"
|
- WITH_LIB="requests1.x"
|
||||||
- WITH_LIB="httplib2"
|
- WITH_LIB="httplib2"
|
||||||
- WITH_LIB="boto"
|
- WITH_LIB="boto"
|
||||||
@@ -38,6 +39,7 @@ install:
|
|||||||
- if [ $WITH_LIB = "requests2.3" ] ; then pip install requests==2.3.0; fi
|
- if [ $WITH_LIB = "requests2.3" ] ; then pip install requests==2.3.0; fi
|
||||||
- if [ $WITH_LIB = "requests2.4" ] ; then pip install requests==2.4.0; fi
|
- if [ $WITH_LIB = "requests2.4" ] ; then pip install requests==2.4.0; fi
|
||||||
- if [ $WITH_LIB = "requests2.5" ] ; then pip install requests==2.5.0; fi
|
- if [ $WITH_LIB = "requests2.5" ] ; then pip install requests==2.5.0; fi
|
||||||
|
- if [ $WITH_LIB = "requests2.7" ] ; then pip install requests==2.7.0; fi
|
||||||
- if [ $WITH_LIB = "httplib2" ] ; then pip install httplib2; fi
|
- if [ $WITH_LIB = "httplib2" ] ; then pip install httplib2; fi
|
||||||
- if [ $WITH_LIB = "boto" ] ; then pip install boto; fi
|
- if [ $WITH_LIB = "boto" ] ; then pip install boto; fi
|
||||||
- if [ $WITH_LIB = "urllib31.7" ] ; then pip install certifi urllib3==1.7.1; fi
|
- if [ $WITH_LIB = "urllib31.7" ] ; then pip install certifi urllib3==1.7.1; fi
|
||||||
|
|||||||
4
MANIFEST.in
Normal file
4
MANIFEST.in
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
include README.md
|
||||||
|
include LICENSE.txt
|
||||||
|
include tox.ini
|
||||||
|
recursive-include tests *
|
||||||
@@ -484,6 +484,8 @@ API in version 1.0.x
|
|||||||
|
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
* 1.4.2 Fix a bug caused by requests 2.7 and chunked transfer encoding
|
||||||
|
* 1.4.1 Include README, tests, LICENSE in package. Thanks @ralphbean.
|
||||||
* 1.4.0 Filter post data parameters (thanks @eadmundo), support for
|
* 1.4.0 Filter post data parameters (thanks @eadmundo), support for
|
||||||
posting files through requests, inject_cassette kwarg to access
|
posting files through requests, inject_cassette kwarg to access
|
||||||
cassette from `use_cassette` decorated function,
|
cassette from `use_cassette` decorated function,
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -20,7 +20,7 @@ class PyTest(TestCommand):
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='vcrpy',
|
name='vcrpy',
|
||||||
version='1.4.0',
|
version='1.4.2',
|
||||||
description=(
|
description=(
|
||||||
"Automatically mock your HTTP interactions to simplify and "
|
"Automatically mock your HTTP interactions to simplify and "
|
||||||
"speed up testing"
|
"speed up testing"
|
||||||
|
|||||||
@@ -64,3 +64,11 @@ def test_cookies(tmpdir):
|
|||||||
r1 = s.get("http://httpbin.org/cookies/set?k1=v1&k2=v2")
|
r1 = s.get("http://httpbin.org/cookies/set?k1=v1&k2=v2")
|
||||||
r2 = s.get("http://httpbin.org/cookies")
|
r2 = s.get("http://httpbin.org/cookies")
|
||||||
assert len(r2.json()['cookies']) == 2
|
assert len(r2.json()['cookies']) == 2
|
||||||
|
|
||||||
|
|
||||||
|
def test_amazon_doctype(tmpdir):
|
||||||
|
# amazon gzips its homepage. For some reason, in requests 2.7, it's not
|
||||||
|
# getting gunzipped.
|
||||||
|
with vcr.use_cassette(str(tmpdir.join('amz.yml'))):
|
||||||
|
r = requests.get('http://www.amazon.com')
|
||||||
|
assert 'html' in r.text
|
||||||
|
|||||||
4
tox.ini
4
tox.ini
@@ -1,5 +1,5 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist = {py26,py27,py33,py34,pypy}-{requests25,requests24,requests23,requests22,requests1,httplib2,urllib317,urllib319,urllib3110,boto}
|
envlist = {py26,py27,py33,py34,pypy}-{requests27,requests26,requests25,requests24,requests23,requests22,requests1,httplib2,urllib317,urllib319,urllib3110,boto}
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
commands =
|
commands =
|
||||||
@@ -16,6 +16,8 @@ deps =
|
|||||||
pytest-localserver
|
pytest-localserver
|
||||||
PyYAML
|
PyYAML
|
||||||
requests1: requests==1.2.3
|
requests1: requests==1.2.3
|
||||||
|
requests27: requests==2.7.0
|
||||||
|
requests22: requests==2.6.0
|
||||||
requests25: requests==2.5.0
|
requests25: requests==2.5.0
|
||||||
requests24: requests==2.4.0
|
requests24: requests==2.4.0
|
||||||
requests23: requests==2.3.0
|
requests23: requests==2.3.0
|
||||||
|
|||||||
@@ -76,6 +76,14 @@ class VCRHTTPResponse(HTTPResponse):
|
|||||||
self._closed = False
|
self._closed = False
|
||||||
|
|
||||||
headers = self.recorded_response['headers']
|
headers = self.recorded_response['headers']
|
||||||
|
# Since we are loading a response that has already been serialized, our
|
||||||
|
# response is no longer chunked. That means we don't want any
|
||||||
|
# libraries trying to process a chunked response. By removing the
|
||||||
|
# transfer-encoding: chunked header, this should cause the downstream
|
||||||
|
# libraries to process this as a non-chunked response.
|
||||||
|
te_key = [h for h in headers.keys() if h.upper() == 'TRANSFER-ENCODING']
|
||||||
|
if te_key:
|
||||||
|
del headers[te_key[0]]
|
||||||
self.headers = self.msg = parse_headers(headers)
|
self.headers = self.msg = parse_headers(headers)
|
||||||
|
|
||||||
self.length = compat.get_header(self.msg, 'content-length') or None
|
self.length = compat.get_header(self.msg, 'content-length') or None
|
||||||
|
|||||||
Reference in New Issue
Block a user