mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(test): FastAPI 0.87.0 - error fixes
FastAPI 0.87.0 switched to the httpx library for their TestClient * allow_redirects is deprecated and replaced by follow_redirects Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
parent
512ba02389
commit
1216399d53
8 changed files with 218 additions and 226 deletions
|
@ -20,7 +20,11 @@ def setup(db_test):
|
|||
|
||||
@pytest.fixture
|
||||
def client() -> TestClient:
|
||||
yield TestClient(app=app)
|
||||
client = TestClient(app=app)
|
||||
|
||||
# disable redirects for our tests
|
||||
client.follow_redirects = False
|
||||
yield client
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -66,7 +70,7 @@ def test_favicon(client: TestClient):
|
|||
"""Test the favicon route at '/favicon.ico'."""
|
||||
with client as request:
|
||||
response1 = request.get("/static/images/favicon.ico")
|
||||
response2 = request.get("/favicon.ico")
|
||||
response2 = request.get("/favicon.ico", follow_redirects=True)
|
||||
assert response1.status_code == int(HTTPStatus.OK)
|
||||
assert response1.content == response2.content
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue