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
