mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-10-30 17:06:06 +08:00
Fix depreciation warning
This commit is contained in:
@ -66,7 +66,7 @@ class TestLogin:
|
||||
):
|
||||
client, _ = test_app_client
|
||||
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
|
||||
|
||||
async def test_missing_username(
|
||||
@ -78,7 +78,7 @@ class TestLogin:
|
||||
client, _ = test_app_client
|
||||
data = {"password": "guinevere"}
|
||||
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
|
||||
|
||||
async def test_missing_password(
|
||||
@ -90,7 +90,7 @@ class TestLogin:
|
||||
client, _ = test_app_client
|
||||
data = {"username": "king.arthur@camelot.bt"}
|
||||
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
|
||||
|
||||
async def test_not_existing_user(
|
||||
|
||||
@ -32,22 +32,22 @@ async def test_app_client(
|
||||
class TestRegister:
|
||||
async def test_empty_body(self, test_app_client: httpx.AsyncClient):
|
||||
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):
|
||||
json = {"password": "guinevere"}
|
||||
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):
|
||||
json = {"email": "king.arthur@camelot.bt"}
|
||||
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):
|
||||
json = {"email": "king.arthur", "password": "guinevere"}
|
||||
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):
|
||||
json = {"email": "king.arthur@camelot.bt", "password": "g"}
|
||||
|
||||
@ -36,7 +36,7 @@ class TestForgotPassword:
|
||||
self, test_app_client: httpx.AsyncClient, user_manager: UserManagerMock
|
||||
):
|
||||
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
|
||||
|
||||
async def test_not_existing_user(
|
||||
@ -77,7 +77,7 @@ class TestResetPassword:
|
||||
user_manager: UserManagerMock,
|
||||
):
|
||||
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
|
||||
|
||||
async def test_missing_token(
|
||||
@ -85,7 +85,7 @@ class TestResetPassword:
|
||||
):
|
||||
json = {"password": "guinevere"}
|
||||
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
|
||||
|
||||
async def test_missing_password(
|
||||
@ -95,7 +95,7 @@ class TestResetPassword:
|
||||
):
|
||||
json = {"token": "foo"}
|
||||
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
|
||||
|
||||
async def test_invalid_token(
|
||||
|
||||
@ -39,7 +39,7 @@ class TestVerifyTokenRequest:
|
||||
user_manager: UserManagerMock,
|
||||
):
|
||||
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
|
||||
|
||||
async def test_wrong_email(
|
||||
@ -49,7 +49,7 @@ class TestVerifyTokenRequest:
|
||||
):
|
||||
json = {"email": "king.arthur"}
|
||||
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
|
||||
|
||||
async def test_user_not_exists(
|
||||
@ -125,7 +125,7 @@ class TestVerify:
|
||||
user_manager: UserManagerMock,
|
||||
):
|
||||
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
|
||||
|
||||
async def test_invalid_verify_token(
|
||||
|
||||
Reference in New Issue
Block a user