add reset password endpoint

This commit is contained in:
2025-12-04 19:46:26 -03:00
parent d29ad3ceb6
commit b929c492c0
9 changed files with 129 additions and 36 deletions

View File

@@ -10,9 +10,10 @@ def test_send_forgot_email(monkeypatch, lambda_context: LambdaContext):
'detail': {
'new_image': {
'id': 'PASSWORD_RESET',
'sk': 'CODE#123',
'sk': 'CODE#820b3cbc-e2e2-440e-9cec-7958725e8f52',
'name': 'Sérgio R Siqueira',
'email': 'sergio@somosbeta.com.br',
'user_id': '6c992e55-f483-44ce-a940-5394c3e00645',
}
}
}

View File

@@ -0,0 +1,24 @@
from http import HTTPMethod, HTTPStatus
from layercake.dynamodb import DynamoDBPersistenceLayer
from ..conftest import HttpApiProxy, LambdaContext
def test_reset(
app,
seeds,
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
http_api_proxy: HttpApiProxy,
lambda_context: LambdaContext,
):
r = app.lambda_handler(
http_api_proxy(
raw_path='/reset/eyJ1c2VyX2lkIjogIjZjOTkyZTU1LWY0ODMtNDRjZS1hOTQwLTUzOTRjM2UwMDY0NSIsICJjb2RlIjogIjgyMGIzY2JjLWUyZTItNDQwZS05Y2VjLTc5NTg3MjVlOGY1MiJ9',
method=HTTPMethod.POST,
body={'new_password': '123@56'},
),
lambda_context,
)
assert r['statusCode'] == HTTPStatus.OK

View File

@@ -28,3 +28,7 @@
{"id": "email", "sk": "sergio@somosbeta.com.br", "user_id": "357db1c5-7442-4075-98a3-fbe5c938a419"}
{"id": "email", "sk": "osergiosiqueira@gmail.com", "user_id": "357db1c5-7442-4075-98a3-fbe5c938a419"}
{"id": "cpf", "sk": "07879819908", "user_id": "357db1c5-7442-4075-98a3-fbe5c938a419"}
{"id": "6c992e55-f483-44ce-a940-5394c3e00645", "sk": "0", "name": "Sérgio R Siqueira"}
{"id": "PASSWORD_RESET", "sk": "USER#6c992e55-f483-44ce-a940-5394c3e00645"}
{"id": "PASSWORD_RESET", "sk": "CODE#820b3cbc-e2e2-440e-9cec-7958725e8f52"}