Close #3: forgot/reset password routes

This commit is contained in:
François Voron
2019-10-13 12:05:10 +02:00
parent ef1f60d7e5
commit 49daeff869
9 changed files with 305 additions and 37 deletions

View File

@@ -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):