add missing files
This commit is contained in:
27
order-events/tests/events/test_append_org_id.py
Normal file
27
order-events/tests/events/test_append_org_id.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from aws_lambda_powertools.utilities.typing import LambdaContext
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, PartitionKey
|
||||
|
||||
import events.append_org_id as app
|
||||
|
||||
|
||||
def test_append_org_id(
|
||||
dynamodb_seeds,
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
event = {
|
||||
'detail': {
|
||||
'new_image': {
|
||||
'id': '9omWNKymwU5U4aeun6mWzZ',
|
||||
'cnpj': '15608435000190',
|
||||
'email': 'sergio@somosbeta.com.br',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert app.lambda_handler(event, lambda_context) # type: ignore
|
||||
|
||||
r = dynamodb_persistence_layer.collection.query(
|
||||
PartitionKey('9omWNKymwU5U4aeun6mWzZ')
|
||||
)
|
||||
assert 2 == len(r['items'])
|
||||
27
order-events/tests/events/test_append_user_id.py
Normal file
27
order-events/tests/events/test_append_user_id.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from aws_lambda_powertools.utilities.typing import LambdaContext
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
|
||||
|
||||
import events.append_user_id as app
|
||||
|
||||
|
||||
def test_append_user_id(
|
||||
dynamodb_seeds,
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
event = {
|
||||
'detail': {
|
||||
'new_image': {
|
||||
'id': '9omWNKymwU5U4aeun6mWzZ',
|
||||
'cpf': '07879819908',
|
||||
'email': 'sergio@somosbeta.com.br',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert app.lambda_handler(event, lambda_context) # type: ignore
|
||||
|
||||
r = dynamodb_persistence_layer.collection.get_item(
|
||||
KeyPair('9omWNKymwU5U4aeun6mWzZ', '0')
|
||||
)
|
||||
assert 'user_id' in r
|
||||
Reference in New Issue
Block a user