Skip to content
Myr

Move test_chunked_upload to test_lowlevel.py

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Braulio Valdivielso Martínez · committed by Braulio Valdivielso Martínez · parent 66c52c3 · Browse files · 2 files+19 added−16 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+19 added−16 removed

  • tests:+19 added−16 removed

2 files+19 added−16 removed

added:tests/test_lowlevel.py+19 added
1import threading2import requests34from testserver.server import Server567def test_chunked_upload():8 """can safely send generators"""9 close_server = threading.Event()10 server = Server.basic_response_server(wait_to_close_event=close_server)11 data = (i for i in [b'a', b'b', b'c']) 1213 with server as (host, port):14 url = 'http://{0}:{1}/'.format(host, port)15 r = requests.post(url, data=data, stream=True)16 close_server.set() # release server block1718 assert r.status_code == 20019 assert r.request.headers['Transfer-Encoding'] == 'chunked'
modified:tests/test_requests.py-16 removed
7 unmodified lines
8import os9import pickle10import collections11import contextlib12import threading1213import io14import requests15import pytest
10 unmodified lines
26from requests.structures import CaseInsensitiveDict27from requests.sessions import SessionRedirectMixin28from requests.models import urlencode29from requests.hooks import default_hooks31from testserver.server import Server30from .compat import StringIO, u3132# Requests to this URL should always fail with a connection timeout (nothing33# listening on that port)
1416 unmodified lines
1450 from requests.packages import chardet14511452 with pytest.raises(ImportError):1453 from requests.packages import webbrowser14561457def test_chunked_upload():1458 """can safely send generators"""1459 block_server = threading.Event()1460 server = Server.basic_response_server(wait_to_close_event=block_server)1461 data = (i for i in [b'a', b'b', b'c']) 14621463 with server as (host, port):1464 url = 'http://{0}:{1}/'.format(host, port)1465 r = requests.post(url, data=data, stream=True)1466 block_server.set() # release server block14671468 assert r.status_code == 2001469 assert r.request.headers['Transfer-Encoding'] == 'chunked'