wip
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import json
|
||||
import pprint
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
from urllib.parse import urlencode
|
||||
|
||||
@@ -36,10 +35,11 @@ def test_token(
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
assert r['statusCode'] == HTTPStatus.OK
|
||||
data = json.loads(r['body'])
|
||||
auth_token = json.loads(r['body'])
|
||||
|
||||
assert r['statusCode'] == HTTPStatus.OK
|
||||
assert auth_token['expires_in'] == 900
|
||||
|
||||
# print(data)
|
||||
r = dynamodb_persistence_layer.query(
|
||||
key_cond_expr='#pk = :pk',
|
||||
expr_attr_name={
|
||||
@@ -49,7 +49,7 @@ def test_token(
|
||||
':pk': 'OAUTH2#TOKEN',
|
||||
},
|
||||
)
|
||||
# pprint.pp(r['items'])
|
||||
assert len(r['items']) == 2
|
||||
|
||||
r = app.lambda_handler(
|
||||
http_api_proxy(
|
||||
@@ -61,7 +61,7 @@ def test_token(
|
||||
body=urlencode(
|
||||
{
|
||||
'grant_type': 'refresh_token',
|
||||
'refresh_token': data['refresh_token'],
|
||||
'refresh_token': auth_token['refresh_token'],
|
||||
'client_id': client_id,
|
||||
}
|
||||
),
|
||||
@@ -70,4 +70,14 @@ def test_token(
|
||||
)
|
||||
|
||||
assert r['statusCode'] == HTTPStatus.OK
|
||||
# print(r['body'])
|
||||
|
||||
r = dynamodb_persistence_layer.query(
|
||||
key_cond_expr='#pk = :pk',
|
||||
expr_attr_name={
|
||||
'#pk': 'id',
|
||||
},
|
||||
expr_attr_values={
|
||||
':pk': 'OAUTH2#TOKEN',
|
||||
},
|
||||
)
|
||||
assert len(r['items']) == 3
|
||||
|
||||
Reference in New Issue
Block a user