32 lines
813 B
Python
32 lines
813 B
Python
from http import HTTPMethod
|
|
|
|
from layercake.dynamodb import DynamoDBPersistenceLayer, PartitionKey
|
|
|
|
from ..conftest import HttpApiProxy, LambdaContext
|
|
|
|
|
|
def test_authentication(
|
|
app,
|
|
seeds,
|
|
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
|
http_api_proxy: HttpApiProxy,
|
|
lambda_context: LambdaContext,
|
|
):
|
|
r = app.lambda_handler(
|
|
http_api_proxy(
|
|
raw_path='/authentication',
|
|
method=HTTPMethod.POST,
|
|
body={
|
|
'username': '07879819908',
|
|
'password': 'pytest@123',
|
|
},
|
|
),
|
|
lambda_context,
|
|
)
|
|
|
|
assert len(r['cookies']) == 1
|
|
|
|
session = dynamodb_persistence_layer.collection.query(PartitionKey('SESSION'))
|
|
# One seesion if created from seeds
|
|
assert len(session['items']) == 2
|