mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-10-31 01:17:12 +08:00
Fix depreciation warning
This commit is contained in:
@ -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(
|
||||||
|
|||||||
@ -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"}
|
||||||
|
|||||||
@ -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(
|
||||||
|
|||||||
@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user