28 lines
742 B
Python
28 lines
742 B
Python
from aws_lambda_powertools.utilities.typing import LambdaContext
|
|
from layercake.dynamodb import DynamoDBPersistenceLayer, PartitionKey
|
|
|
|
import events.remove_slots_on_canceled as app
|
|
|
|
|
|
def test_delete_slots_on_canceled(
|
|
dynamodb_seeds,
|
|
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
|
lambda_context: LambdaContext,
|
|
):
|
|
event = {
|
|
'detail': {
|
|
'new_image': {
|
|
'id': '9omWNKymwU5U4aeun6mWzZ',
|
|
'status': 'CANCELED',
|
|
}
|
|
}
|
|
}
|
|
|
|
assert app.lambda_handler(event, lambda_context) # type: ignore
|
|
|
|
result = dynamodb_persistence_layer.collection.query(
|
|
PartitionKey('vacancies#cJtK9SsnJhKPyxESe7g3DG')
|
|
)
|
|
|
|
assert len(result['items']) == 0
|