Ejemplo n.º 1
0
def source_text_mardown_to_archetype(message, context):
    events = parse_aws_event(message)
    if not events:
        logger.warn("No events found in message!\n%s" % message)
    for event in events:
        if event.is_save_event:
            archivist = S3archivist(event.bucket)
            resource = archivist.get(event.key)
            on_save(archivist, resource)
        else:
            logger.warn("Not a save event!\n%s" % event)
Ejemplo n.º 2
0
def update_item_index(message, context):
    "When the archive changes, update the index tables to match."
    events = parse_aws_event(message)
    if not events:
        logger.warn("No events found in message!\n%s" % message)
    for event in events:
        if event.is_save_event:
            db = boto3.resource('dynamodb', region_name=event.region)
            archivist = S3archivist(event.bucket)
            resource = archivist.get(event.key)
            on_save(db, archivist, resource)
        else:
            logger.warn("Not a save event!\n%s" % event)
Ejemplo n.º 3
0
def test_parse_sns_event():
    message = stubs.sns_event
    result = parse_aws_event(message)

    assert len(result) == 1
    assert type(result[0]) == S3event