From b392b7ea591734813e94c9f0237365a53e17f91e Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 29 Apr 2019 16:08:31 +0100 Subject: [PATCH] Test allow_redirects=False --- tests/adapters/test_redirects.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/adapters/test_redirects.py b/tests/adapters/test_redirects.py index 56ee9197..3197cc3a 100644 --- a/tests/adapters/test_redirects.py +++ b/tests/adapters/test_redirects.py @@ -108,6 +108,15 @@ async def test_redirect_303(): assert len(response.history) == 1 +@pytest.mark.asyncio +async def test_disallow_redirects(): + client = RedirectAdapter(MockDispatch()) + response = await client.request("POST", "https://example.org/redirect_303", allow_redirects=False) + assert response.status_code == codes.see_other + assert response.url == URL("https://example.org/redirect_303") + assert len(response.history) == 0 + + @pytest.mark.asyncio async def test_relative_redirect(): client = RedirectAdapter(MockDispatch())