mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2026-03-13 07:49:55 +08:00
Close #3: forgot/reset password routes
This commit is contained in:
@@ -6,13 +6,20 @@ from starlette.testclient import TestClient
|
||||
from fastapi_users import FastAPIUsers
|
||||
from fastapi_users.models import BaseUser, BaseUserDB
|
||||
|
||||
SECRET = "SECRET"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def fastapi_users(mock_user_db, mock_authentication) -> FastAPIUsers:
|
||||
class User(BaseUser):
|
||||
pass
|
||||
|
||||
return FastAPIUsers(mock_user_db, mock_authentication, User)
|
||||
def on_after_forgot_password(user, token):
|
||||
pass
|
||||
|
||||
return FastAPIUsers(
|
||||
mock_user_db, mock_authentication, User, on_after_forgot_password, SECRET
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -43,6 +50,12 @@ class TestRouter:
|
||||
response = test_app_client.post("/login")
|
||||
assert response.status_code != status.HTTP_404_NOT_FOUND
|
||||
|
||||
response = test_app_client.post("/forgot-password")
|
||||
assert response.status_code != status.HTTP_404_NOT_FOUND
|
||||
|
||||
response = test_app_client.post("/reset-password")
|
||||
assert response.status_code != status.HTTP_404_NOT_FOUND
|
||||
|
||||
|
||||
class TestGetCurrentUser:
|
||||
def test_missing_token(self, test_app_client: TestClient):
|
||||
|
||||
Reference in New Issue
Block a user