from layercake.dynamodb import PartitionKey

import events.stopgap.remove_slots as app

from ...conftest import LambdaContext


def test_remove_slots(
    dynamodb_seeds,
    dynamodb_persistence_layer,
    lambda_context: LambdaContext,
):
    event = {
        'detail': {
            'new_image': {
                'id': '9omWNKymwU5U4aeun6mWzZ',
                'sk': 'generated_items',
                'create_date': '2024-07-23T20:43:37.303418-03:00',
                'status': 'SUCCESS',
                'scope': 'MILTI_USER',
            }
        },
    }
    assert app.lambda_handler(event, lambda_context)  # type: ignore

    result = dynamodb_persistence_layer.collection.query(
        PartitionKey('vacancies#cJtK9SsnJhKPyxESe7g3DG')
    )

    assert len(result['items']) == 0
