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)
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
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
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
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'