Fix depreciation warning

This commit is contained in:
François Voron
2025-10-24 18:06:39 +02:00
parent df930dc20b
commit 1d91040207
4 changed files with 14 additions and 14 deletions

View File

@ -66,7 +66,7 @@ class TestLogin:
): ):
client, _ = test_app_client client, _ = test_app_client
response = await client.post(path, data={}) response = await client.post(path, data={})
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
assert user_manager.on_after_login.called is False assert user_manager.on_after_login.called is False
async def test_missing_username( async def test_missing_username(
@ -78,7 +78,7 @@ class TestLogin:
client, _ = test_app_client client, _ = test_app_client
data = {"password": "guinevere"} data = {"password": "guinevere"}
response = await client.post(path, data=data) response = await client.post(path, data=data)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
assert user_manager.on_after_login.called is False assert user_manager.on_after_login.called is False
async def test_missing_password( async def test_missing_password(
@ -90,7 +90,7 @@ class TestLogin:
client, _ = test_app_client client, _ = test_app_client
data = {"username": "king.arthur@camelot.bt"} data = {"username": "king.arthur@camelot.bt"}
response = await client.post(path, data=data) response = await client.post(path, data=data)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
assert user_manager.on_after_login.called is False assert user_manager.on_after_login.called is False
async def test_not_existing_user( async def test_not_existing_user(

View File

@ -32,22 +32,22 @@ async def test_app_client(
class TestRegister: class TestRegister:
async def test_empty_body(self, test_app_client: httpx.AsyncClient): async def test_empty_body(self, test_app_client: httpx.AsyncClient):
response = await test_app_client.post("/register", json={}) response = await test_app_client.post("/register", json={})
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
async def test_missing_email(self, test_app_client: httpx.AsyncClient): async def test_missing_email(self, test_app_client: httpx.AsyncClient):
json = {"password": "guinevere"} json = {"password": "guinevere"}
response = await test_app_client.post("/register", json=json) response = await test_app_client.post("/register", json=json)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
async def test_missing_password(self, test_app_client: httpx.AsyncClient): async def test_missing_password(self, test_app_client: httpx.AsyncClient):
json = {"email": "king.arthur@camelot.bt"} json = {"email": "king.arthur@camelot.bt"}
response = await test_app_client.post("/register", json=json) response = await test_app_client.post("/register", json=json)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
async def test_wrong_email(self, test_app_client: httpx.AsyncClient): async def test_wrong_email(self, test_app_client: httpx.AsyncClient):
json = {"email": "king.arthur", "password": "guinevere"} json = {"email": "king.arthur", "password": "guinevere"}
response = await test_app_client.post("/register", json=json) response = await test_app_client.post("/register", json=json)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
async def test_invalid_password(self, test_app_client: httpx.AsyncClient): async def test_invalid_password(self, test_app_client: httpx.AsyncClient):
json = {"email": "king.arthur@camelot.bt", "password": "g"} json = {"email": "king.arthur@camelot.bt", "password": "g"}

View File

@ -36,7 +36,7 @@ class TestForgotPassword:
self, test_app_client: httpx.AsyncClient, user_manager: UserManagerMock self, test_app_client: httpx.AsyncClient, user_manager: UserManagerMock
): ):
response = await test_app_client.post("/forgot-password", json={}) response = await test_app_client.post("/forgot-password", json={})
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
assert user_manager.forgot_password.called is False assert user_manager.forgot_password.called is False
async def test_not_existing_user( async def test_not_existing_user(
@ -77,7 +77,7 @@ class TestResetPassword:
user_manager: UserManagerMock, user_manager: UserManagerMock,
): ):
response = await test_app_client.post("/reset-password", json={}) response = await test_app_client.post("/reset-password", json={})
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
assert user_manager.reset_password.called is False assert user_manager.reset_password.called is False
async def test_missing_token( async def test_missing_token(
@ -85,7 +85,7 @@ class TestResetPassword:
): ):
json = {"password": "guinevere"} json = {"password": "guinevere"}
response = await test_app_client.post("/reset-password", json=json) response = await test_app_client.post("/reset-password", json=json)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
assert user_manager.reset_password.called is False assert user_manager.reset_password.called is False
async def test_missing_password( async def test_missing_password(
@ -95,7 +95,7 @@ class TestResetPassword:
): ):
json = {"token": "foo"} json = {"token": "foo"}
response = await test_app_client.post("/reset-password", json=json) response = await test_app_client.post("/reset-password", json=json)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
assert user_manager.reset_password.called is False assert user_manager.reset_password.called is False
async def test_invalid_token( async def test_invalid_token(

View File

@ -39,7 +39,7 @@ class TestVerifyTokenRequest:
user_manager: UserManagerMock, user_manager: UserManagerMock,
): ):
response = await test_app_client.post("/request-verify-token", json={}) response = await test_app_client.post("/request-verify-token", json={})
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
assert user_manager.request_verify.called is False assert user_manager.request_verify.called is False
async def test_wrong_email( async def test_wrong_email(
@ -49,7 +49,7 @@ class TestVerifyTokenRequest:
): ):
json = {"email": "king.arthur"} json = {"email": "king.arthur"}
response = await test_app_client.post("/request-verify-token", json=json) response = await test_app_client.post("/request-verify-token", json=json)
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
assert user_manager.request_verify.called is False assert user_manager.request_verify.called is False
async def test_user_not_exists( async def test_user_not_exists(
@ -125,7 +125,7 @@ class TestVerify:
user_manager: UserManagerMock, user_manager: UserManagerMock,
): ):
response = await test_app_client.post("/verify", json={}) response = await test_app_client.post("/verify", json={})
assert response.status_code == status.HTTP_422_UNPROCESSABLE_ENTITY assert response.status_code == status.HTTP_422_UNPROCESSABLE_CONTENT
assert user_manager.verify.called is False assert user_manager.verify.called is False
async def test_invalid_verify_token( async def test_invalid_verify_token(