]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
pytest-httpbin doesn't support chunked requests on Python 3.6
authorThomas Grainger <tom@procensus.com>
Tue, 4 Apr 2017 09:31:44 +0000 (10:31 +0100)
committerThomas Grainger <tom@procensus.com>
Tue, 4 Apr 2017 10:30:16 +0000 (11:30 +0100)
tests/integration/test_requests.py

index 804ab2e3f348eed631889ee9079d245952eb5f38..4229a0fa54400f6ea00bd2c4fe054eec768a149b 100644 (file)
@@ -4,8 +4,8 @@ import pytest
 import vcr
 from assertions import assert_cassette_empty, assert_is_json
 
-
 requests = pytest.importorskip("requests")
+from requests.exceptions import ConnectionError  # noqa E402
 
 
 def test_status_code(httpbin_both, tmpdir):
@@ -100,11 +100,26 @@ def test_post(tmpdir, httpbin_both):
     assert req1 == req2
 
 
-def test_post_chunked_binary(tmpdir, httpbin_both):
+def test_post_chunked_binary(tmpdir, httpbin):
     '''Ensure that we can send chunked binary without breaking while trying to concatenate bytes with str.'''
     data1 = iter([b'data', b'to', b'send'])
     data2 = iter([b'data', b'to', b'send'])
-    url = httpbin_both.url + '/post'
+    url = httpbin.url + '/post'
+    with vcr.use_cassette(str(tmpdir.join('requests.yaml'))):
+        req1 = requests.post(url, data1).content
+
+    with vcr.use_cassette(str(tmpdir.join('requests.yaml'))):
+        req2 = requests.post(url, data2).content
+
+    assert req1 == req2
+
+
+@pytest.mark.xfail('sys.version_info >= (3, 6)', strict=True, raises=ConnectionError)
+def test_post_chunked_binary_secure(tmpdir, httpbin_secure):
+    '''Ensure that we can send chunked binary without breaking while trying to concatenate bytes with str.'''
+    data1 = iter([b'data', b'to', b'send'])
+    data2 = iter([b'data', b'to', b'send'])
+    url = httpbin_secure.url + '/post'
     with vcr.use_cassette(str(tmpdir.join('requests.yaml'))):
         req1 = requests.post(url, data1).content
         print(req1)