40 lines
972 B
Python
40 lines
972 B
Python
import json
|
|
from http import HTTPMethod
|
|
|
|
from layercake.dynamodb import DynamoDBPersistenceLayer, PartitionKey
|
|
|
|
from ..conftest import HttpApiProxy, LambdaContext
|
|
|
|
|
|
def test_forgot(
|
|
app,
|
|
seeds,
|
|
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
|
http_api_proxy: HttpApiProxy,
|
|
lambda_context: LambdaContext,
|
|
):
|
|
r = app.lambda_handler(
|
|
http_api_proxy(
|
|
raw_path='/forgot',
|
|
method=HTTPMethod.POST,
|
|
body={'username': '07879819908'},
|
|
),
|
|
lambda_context,
|
|
)
|
|
body = json.loads(r['body'])
|
|
assert 's***io@somosbeta.com.br' == body['email']
|
|
|
|
app.lambda_handler(
|
|
http_api_proxy(
|
|
raw_path='/forgot',
|
|
method=HTTPMethod.POST,
|
|
body={'username': '07879819908'},
|
|
),
|
|
lambda_context,
|
|
)
|
|
|
|
forgot = dynamodb_persistence_layer.collection.query(
|
|
PartitionKey('PASSWORD_RESET'),
|
|
)
|
|
assert len(forgot['items']) == 5
|