]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Test allow_redirects=False
authorTom Christie <tom@tomchristie.com>
Mon, 29 Apr 2019 15:08:31 +0000 (16:08 +0100)
committerTom Christie <tom@tomchristie.com>
Mon, 29 Apr 2019 15:08:31 +0000 (16:08 +0100)
tests/adapters/test_redirects.py

index 56ee919751048b5623a3dc7f752d9f7dc382ac36..3197cc3a1f0f6e2939dcbf6d238af1024094e82e 100644 (file)
@@ -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())