add fallback to id
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from http import HTTPMethod
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, PartitionKey
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair, PartitionKey
|
||||
|
||||
from ..conftest import HttpApiProxy, LambdaContext
|
||||
|
||||
@@ -29,3 +29,31 @@ def test_authentication(
|
||||
session = dynamodb_persistence_layer.collection.query(PartitionKey('SESSION'))
|
||||
# One seesion if created from seeds
|
||||
assert len(session['items']) == 2
|
||||
|
||||
|
||||
def test_invalid_password(
|
||||
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': '123333',
|
||||
},
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
|
||||
assert r['statusCode'] == HTTPStatus.UNAUTHORIZED
|
||||
|
||||
failed = dynamodb_persistence_layer.collection.get_item(
|
||||
KeyPair('357db1c5-7442-4075-98a3-fbe5c938a419', 'FAILED_ATTEMPTS')
|
||||
)
|
||||
|
||||
assert 'failed_attempts' in failed
|
||||
|
||||
Reference in New Issue
Block a user