Exemple #1
0
def audio_repository():
    parser = ExpressionParser()
    audio_repository = MemoryAudioRepository(parser)
    audio_repository.load({
        '001': Audio(id='001', reference='ABC'),
        '002': Audio(id='002', reference='XYZ')
    })
    return audio_repository
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 image_repository():
    parser = ExpressionParser()
    image_repository = MemoryImageRepository(parser)
    image_repository.load({
        '001': Image(id='001', reference='ABC'),
        '002': Image(id='002', reference='XYZ')
    })
    return image_repository
Exemple #4
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)
def memory_repository() -> MemoryRepository:
    parser = ExpressionParser()
    entity_dict = {
        "1": DummyEntity('1', 'value_1'),
        "2": DummyEntity('2', 'value_2'),
        "3": DummyEntity('3', 'value_3'),
    }
    repository = MemoryRepository[DummyEntity](parser)
    repository.load(entity_dict)
    return repository
def test_memory_repository_add() -> None:
    parser = ExpressionParser()
    memory_repository = MemoryRepository[DummyEntity](parser)

    item = DummyEntity("1", "value_1")

    is_saved = memory_repository.add(item)

    assert len(memory_repository.items) == 1
    assert is_saved
    assert "1" in memory_repository.items.keys()
    assert item in memory_repository.items.values()
Exemple #7
0
def shelve_repository(dummy_shelve) -> ShelveRepository:
    with shelve.open(dummy_shelve) as items:
        items.clear()
    parser = ExpressionParser()
    entity_dict = {
        "1": DummyEntity('1', 'value_1'),
        "2": DummyEntity('2', 'value_2'),
        "3": DummyEntity('3', 'value_3')
    }
    print('dummy_shelve', dummy_shelve)
    repository = ShelveRepository[DummyEntity](parser, dummy_shelve)
    repository.load(entity_dict)
    return repository
Exemple #8
0
def parser() -> ExpressionParser:
    return ExpressionParser()