diff --git a/gestao/tests/test_login.py b/gestao/tests/test_login.py index 90ff8dc..43e94b7 100644 --- a/gestao/tests/test_login.py +++ b/gestao/tests/test_login.py @@ -82,9 +82,10 @@ async def test_recover_password_incorrect( assert response.status_code == 404 - @pytest.mark.anyio -async def test_recover_password_AuthenticationError(client: AsyncClient, fastapi_app: FastAPI) -> None: +async def test_recover_password_AuthenticationError( + client: AsyncClient, fastapi_app: FastAPI +) -> None: url = fastapi_app.url_path_for("create_user") user = generate_fake_user() response = await client.post(url, json=user) @@ -94,7 +95,7 @@ async def test_recover_password_AuthenticationError(client: AsyncClient, fastapi assert isinstance(user_instance, User) user_credentials = { - "email": user_data['email'], + "email": user_data["email"], } url = fastapi_app.url_path_for("recover_password") diff --git a/gestao/tests/test_user.py b/gestao/tests/test_user.py index 15225e0..6da76c9 100644 --- a/gestao/tests/test_user.py +++ b/gestao/tests/test_user.py @@ -64,12 +64,14 @@ async def test_create_user_incorrect(client: AsyncClient, fastapi_app: FastAPI) @pytest.mark.anyio -async def test_create_user_UniqueViolation(client: AsyncClient, fastapi_app: FastAPI) -> None: +async def test_create_user_UniqueViolation( + client: AsyncClient, fastapi_app: FastAPI +) -> None: url = fastapi_app.url_path_for("create_user") user = generate_fake_user() response = await client.post(url, json=user) assert response.status_code == 200 - + response = await client.post(url, json=user) assert response.status_code == 400 diff --git a/gestao/web/api/login/views.py b/gestao/web/api/login/views.py index 3f5cecd..252f733 100644 --- a/gestao/web/api/login/views.py +++ b/gestao/web/api/login/views.py @@ -39,7 +39,9 @@ async def recover_password(request: Request, recover_data: RecoverPasswordDTO) - await user.update(password=new_password) except SMTPAuthenticationError: logging.error("Authentication error while sending email", exc_info=True) - raise HTTPException(status_code=400, detail='Authentication error while sending email') + raise HTTPException( + status_code=400, detail="Authentication error while sending email" + ) except Exception: logging.error("User not found", exc_info=True) raise HTTPException(status_code=404, detail="User not found")