Skip to content
Myr

Update tests to work offline

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

authored by Ian Cordasco · committed by Ian Cordasco · parent 90857b8 · Browse files · 1 file+7 added−7 removed
This commit

State

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

Diff stats

1 file+7 added−7 removed

  • other:+7 added−7 removed

1 file+7 added−7 removed

modified:test_requests.py+7 added-7 removed
256 unmodified lines
257 def test_headers_on_session_with_None_are_not_sent(self):258 """Do not send headers in Session.headers with None values."""259 ses = requests.Session()260 ses.headers['Accept-Encoding'] = None261 req = requests.Request('GET', 'http://httpbin.org/get')261 req = requests.Request('GET', httpbin('get'))262 prep = ses.prepare_request(req)263 assert 'Accept-Encoding' not in prep.headers264265 def test_user_agent_transfers(self):
741 unmodified lines
1007 assert isinstance(s, builtin_str)1008 assert s == "Basic dGVzdDp0ZXN0"10091010 def test_requests_history_is_saved(self):1011 r = requests.get('https://httpbin.org/redirect/5')1011 r = requests.get(httpbin('redirect/5'))1012 total = r.history[-1].history1013 i = 01014 for item in r.history:1015 assert item.history == total[0:i]1016 i=i+11016 i = i + 110171018 def test_json_param_post_content_type_works(self):1019 r = requests.post(1020 httpbin('post'),
328 unmodified lines
13491350class TestTimeout:1351 def test_stream_timeout(self):1352 try:1353 requests.get('https://httpbin.org/delay/10', timeout=2.0)1353 requests.get(httpbin('delay/10'), timeout=2.0)1354 except requests.exceptions.Timeout as e:1355 assert 'Read timed out' in e.args[0].args[0]13561357 def test_invalid_timeout(self):
91 unmodified lines
1449 }14501451 def test_requests_are_updated_each_time(self):1452 session = RedirectSession([303, 307])1453 prep = requests.Request('POST', 'http://httpbin.org/post').prepare()1453 prep = requests.Request('POST', httpbin('post')).prepare()1454 r0 = session.send(prep)1455 assert r0.request.method == 'POST'1456 assert session.calls[-1] == SendCall((r0.request,), {})1457 redirect_generator = session.resolve_redirects(r0, prep)
75 unmodified lines
15331534def test_urllib3_retries():1535 from requests.packages.urllib3.util import Retry1536 s = requests.Session()1537 s.mount('https://', HTTPAdapter(max_retries=Retry(1537 s.mount('http://', HTTPAdapter(max_retries=Retry(1538 total=2, status_forcelist=[500]1539 )))15401541 with pytest.raises(RetryError):1542 s.get('https://httpbin.org/status/500')1542 s.get(httpbin('status/500'))15431544if __name__ == '__main__':1545 unittest.main()