From: Tom Christie Date: Mon, 29 Apr 2019 15:08:31 +0000 (+0100) Subject: Test allow_redirects=False X-Git-Tag: 0.3.0~66^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b392b7ea591734813e94c9f0237365a53e17f91e;p=thirdparty%2Fhttpx.git Test allow_redirects=False --- 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())