예제 #1
0
def test_library_es_mapping(es_clear, db, library_data, organisation):
    """."""
    search = LibrariesSearch()
    mapping = get_mapping(search.Meta.index)
    assert mapping
    Library.create(library_data, dbcommit=True, reindex=True, delete_pid=True)
    assert mapping == get_mapping(search.Meta.index)
def test_library_es_mapping(es_clear, db, lib_martigny_data, org_martigny):
    """Test library elasticsearch mapping."""
    search = LibrariesSearch()
    mapping = get_mapping(search.Meta.index)
    assert mapping
    Library.create(
        lib_martigny_data, dbcommit=True, reindex=True, delete_pid=True)
    assert mapping == get_mapping(search.Meta.index)
예제 #3
0
def lib_martigny(app, org_martigny, lib_martigny_data):
    """Martigny-ville library."""
    lib = Library.create(data=lib_martigny_data,
                         delete_pid=False,
                         dbcommit=True,
                         reindex=True)
    flush_index(LibrariesSearch.Meta.index)
    return lib
예제 #4
0
def lib_aproz(app, org_sion, lib_aproz_data):
    """Aproz library."""
    lib = Library.create(data=lib_aproz_data,
                         delete_pid=False,
                         dbcommit=True,
                         reindex=True)
    flush_index(LibrariesSearch.Meta.index)
    return lib
예제 #5
0
def library(app, organisation, library_data):
    """."""
    lib = Library.create(data=library_data,
                         delete_pid=False,
                         dbcommit=True,
                         reindex=True)
    flush_index(LibrariesSearch.Meta.index)
    return lib
예제 #6
0
def test_library_create(db, library_data):
    """Test libanisation creation."""
    lib = Library.create(library_data, delete_pid=True)
    assert lib == library_data
    assert lib.get('pid') == '1'

    lib = Library.get_record_by_pid('1')
    assert lib == library_data

    fetched_pid = fetcher(lib.id, lib)
    assert fetched_pid.pid_value == '1'
    assert fetched_pid.pid_type == 'lib'