update session

This commit is contained in:
2025-10-10 12:52:41 -03:00
parent 2de2d4dc0e
commit c9438d49fb
15 changed files with 116 additions and 112 deletions

View File

@@ -16,7 +16,7 @@ def test_authorize(
http_api_proxy: HttpApiProxy,
lambda_context: LambdaContext,
):
session_id = new_session(USER_ID)
session = new_session(USER_ID)
r = app.lambda_handler(
http_api_proxy(
@@ -31,7 +31,7 @@ def test_authorize(
'state': '456',
},
cookies=[
f'session_id={session_id}; HttpOnly; Secure',
f'__session={session}; HttpOnly; Secure',
],
),
lambda_context,
@@ -60,7 +60,7 @@ def test_forbidden(
http_api_proxy: HttpApiProxy,
lambda_context: LambdaContext,
):
session_id = new_session('fd5914ec-fd37-458b-b6b9-8aeab38b666b')
session = new_session('fd5914ec-fd37-458b-b6b9-8aeab38b666b')
r = app.lambda_handler(
http_api_proxy(
@@ -75,7 +75,7 @@ def test_forbidden(
'state': '456',
},
cookies=[
f'session_id={session_id}; HttpOnly; Secure',
f'__session={session}; HttpOnly; Secure',
],
),
lambda_context,
@@ -84,15 +84,13 @@ def test_forbidden(
assert r['statusCode'] == HTTPStatus.FORBIDDEN
def test_authorize_revoked(
def test_invalid_session(
app,
seeds,
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
http_api_proxy: HttpApiProxy,
lambda_context: LambdaContext,
):
invalid_session_id = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiIwNTgzNTBhYi02NGU1LTQ0MzEtYmQyNy01MGVhOWIxNmQxZGYiLCJzdWIiOiIzNTdkYjFjNS03NDQyLTQwNzUtOThhMy1mYmU1YzkzOGE0MTkiLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0IiwiaWF0IjoxNzU1Mzk3Nzk5LCJleHAiOjE3NTUzOTg2OTl9.dDbiHYReVERbkNH2df4sXK2VIwT7G1KjNC5UrBuN6IQ'
r = app.lambda_handler(
http_api_proxy(
raw_path='/authorize',
@@ -106,7 +104,7 @@ def test_authorize_revoked(
'state': '456',
},
cookies=[
f'session_id={invalid_session_id}; HttpOnly; Secure',
'__session=10:10; HttpOnly; Secure',
],
),
lambda_context,