def test_s3event_construct(): event = stubs.generate_event()['Records'][0] ev = S3event(event) assert ev.bucket == event['s3']['bucket']['name'] assert ev.etag == event['s3']['object']['eTag'] assert ev.key == event['s3']['object']['key'] assert ev.name == event['eventName'] assert ev.region == event['awsRegion'] assert ev.sequencer == event['s3']['object']['sequencer'] assert ev.source == event['eventSource'] assert ev.time == event['eventTime'] assert hasattr(ev.datetime, 'isoformat')
def test_parse_aws_event(): message = stubs.generate_event() result = parse_aws_event(message) assert len(result) == 1 assert type(result[0]) == S3event