Exemple #1
0
def test_memory_file_store_service_store() -> None:
    locator = 'ec892a1e-a05b-4152-b0e4-1be9b276005c'
    content = 'BASE64_ENCODED_CONTENT'

    file_store_service = MemoryFileStoreService()
    uri = file_store_service.store(locator, content)

    assert isinstance(uri, str)
    assert uri == locator
def image_storage_coordinator():
    parser = ExpressionParser()
    image_repository = MemoryImageRepository(parser)
    id_service = StandardIdService()
    file_store_service = MemoryFileStoreService()

    return ImageStorageCoordinator(
        image_repository, id_service, file_store_service)
Exemple #3
0
def audio_storage_coordinator():
    parser = ExpressionParser()
    audio_repository = MemoryAudioRepository(parser)
    id_service = StandardIdService()
    file_store_service = MemoryFileStoreService()

    return AudioStorageCoordinator(audio_repository, id_service,
                                   file_store_service)
async def test_memory_file_store_service_store() -> None:
    file_id = 'ec892a1e-a05b-4152-b0e4-1be9b276005c'
    content = b'BASE64_ENCODED_CONTENT'
    contexts = [{'id': file_id, 'content': content}]

    file_store_service = MemoryFileStoreService(StandardTenantProvider(),
                                                StandardAuthProvider())
    uri, *_ = await file_store_service.store(contexts)

    assert isinstance(uri, str)
    assert uri == file_id
async def test_memory_file_store_service_store_many() -> None:
    contexts = [{
        'id': 'ec892a1e-a05b-4152-b0e4-1be9b276005c',
        'content': b'BASE64_ENCODED_CONTENT'
    }, {
        'id': '3054a584-2f8e-4a62-b480-0405b311a5aa',
        'content': b'BASE64_ENCODED_CONTENT'
    }]

    file_store_service = MemoryFileStoreService(StandardTenantProvider(),
                                                StandardAuthProvider())

    uris = await file_store_service.store(contexts)

    assert len(uris) == len(contexts)
    assert uris[0] == contexts[0]['id']
    assert uris[1] == contexts[1]['id']
 def store(self, locator: str, content: str, extension: str = None):
     nonlocal called
     called = True
     file_store_service = MemoryFileStoreService()
     return file_store_service.store(locator, content, extension)
Exemple #7
0
def file_store_service(tenant_provider, auth_provider):
    return MemoryFileStoreService(tenant_provider, auth_provider)
Exemple #8
0
def file_reporter():
    file_store_service = MemoryFileStoreService(
        StandardTenantProvider(),
        StandardAuthProvider())
    return StandardFileReporter(file_store_service)