This commit is contained in:
2025-03-28 20:37:04 -03:00
parent a1141dcce8
commit dbe7a924e2
10 changed files with 89 additions and 105 deletions

View File

@@ -59,6 +59,7 @@ class HttpApiProxy:
'custom:user_id': '5OxmMjL-ujoR5IMGegQz',
'sub': 'c4f30dbd-083e-4b84-aa50-c31afe9b9c01',
},
'auth_flow_type': 'USER_AUTH',
},
'jwt': {
'claims': {'claim1': 'value1', 'claim2': 'value2'},

View File

@@ -26,7 +26,8 @@ def test_bearer_jwt(lambda_context: LambdaContext):
'sub': '58efed8d-d276-41a8-8502-4ab8b5a6415e',
'name': 'pytest',
'custom:user_id': '5OxmMjL-ujoR5IMGegQz',
}
},
'auth_flow_type': 'USER_AUTH',
},
}
@@ -55,10 +56,11 @@ def test_bearer_apikey(
'name': 'Sérgio R Siqueira',
'email': 'sergio@somosbeta.com.br',
},
'auth_flow_type': 'API_AUTH',
},
}
# # This data was added from seeds
# This data was added from seeds
assert app.lambda_handler(
{
'headers': {
@@ -75,11 +77,11 @@ def test_parse_bearer_token_api_key():
)
assert bearer.token == '35433970-6857-4062-bb43-f71683b2f68e' # type: ignore
assert bearer.auth_type == 'API_KEY' # type: ignore
assert bearer.auth_flow_type == 'API_AUTH' # type: ignore
def test_parse_bearer_token_user_token():
bearer = _parse_bearer_token('Bearer d977f5a2-0302-4dd2-87c7-57414264d27a')
assert bearer.token == 'd977f5a2-0302-4dd2-87c7-57414264d27a' # type: ignore
assert bearer.auth_type == 'USER_TOKEN' # type: ignore
assert bearer.auth_flow_type == 'USER_AUTH' # type: ignore