From b572291dff02a41636acbf8f829fd5c6f06c1f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Rafael=20Siqueira?= Date: Thu, 7 Aug 2025 00:48:32 -0300 Subject: [PATCH] add test --- .../tests/routes/test_token.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 id.saladeaula.digital/tests/routes/test_token.py diff --git a/id.saladeaula.digital/tests/routes/test_token.py b/id.saladeaula.digital/tests/routes/test_token.py new file mode 100644 index 0000000..3d75a0e --- /dev/null +++ b/id.saladeaula.digital/tests/routes/test_token.py @@ -0,0 +1,39 @@ +from http import HTTPMethod +from urllib.parse import urlencode + +from layercake.dynamodb import DynamoDBPersistenceLayer + +from ..conftest import HttpApiProxy, LambdaContext + + +def test_token( + app, + seeds, + dynamodb_persistence_layer: DynamoDBPersistenceLayer, + http_api_proxy: HttpApiProxy, + lambda_context: LambdaContext, +): + client_id = 'd72d4005-1fa7-4430-9754-80d5e2487bb6' + + r = app.lambda_handler( + http_api_proxy( + raw_path='/token', + method=HTTPMethod.POST, + headers={ + 'Content-Type': 'application/x-www-form-urlencoded', + }, + body=urlencode( + { + 'grant_type': 'authorization_code', + 'redirect_uri': 'https://localhost/callback', + 'code': 'kyqp3oSuRFTfuBaCmq3XOgGWg67l42Kt3D6xPEj7Yd3MLdi9', + 'client_id': client_id, + 'code_verifier': '9072df2d3709425993e733f38fb27a825b8860e699364ce9abafdf51077c0bdb4e456ddb741147a4bec4eeda782d92cc', + # 'client_secret': '1nFD8alDbGHgc3g1RLY960xyRJVee0SlMoIB0MUlSuiJy28W', + } + ), + ), + lambda_context, + ) + + print(r)