Exemplo n.º 1
0
async def dynamodb_resource(request, region, config, event_loop,
                            dynamodb2_server):
    session = Session(region_name=region, **moto_config())

    async with session.resource('dynamodb',
                                region_name=region,
                                endpoint_url=dynamodb2_server,
                                config=config) as resource:
        yield resource
Exemplo n.º 2
0
async def s3_resource(request, region, config, event_loop, s3_server,
                      bucket_name):
    session = Session(region_name=region, **moto_config())

    async with session.resource('s3',
                                region_name=region,
                                endpoint_url=s3_server,
                                config=config) as resource:
        yield resource
Exemplo n.º 3
0
def dynamodb_resource(request, region, config, event_loop, dynamodb2_server):
    session = Session(region_name=region, loop=event_loop, **moto_config())
    resource = session.resource('dynamodb', region_name=region, endpoint_url=dynamodb2_server, config=config)
    yield resource

    def fin():
        event_loop.run_until_complete(resource.close())

    request.addfinalizer(fin)