Skip to content
Myr

add a test for max_redirects in safe/normal modes

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

authored by Shivaram Lingamneni · committed by Shivaram Lingamneni · parent a903391 · Browse files · 1 file+10 added−0 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+10 added−0 removed

  • tests:+10 added−0 removed

1 file+10 added−0 removed

modified:tests/test_requests.py+10 added
845 unmodified lines
846 def test_empty_response(self):847 r = requests.get(httpbin('status', '404'))848 r.text849850 def test_max_redirects(self):851 def unsafe_callable():852 requests.get("http://httpbin.org/redirect/3", config=dict(max_redirects=2))853 self.assertRaises(requests.exceptions.TooManyRedirects, unsafe_callable)854855 # add safe mode856 response = requests.get("http://httpbin.org/redirect/3", config=dict(safe_mode=True, max_redirects=2))857 self.assertTrue(response.content is None)858 self.assertTrue(isinstance(response.error, requests.exceptions.TooManyRedirects))859860if __name__ == '__main__':861 unittest.main()