def test_indexer_deletes_record_from_es(inspire_app, datadir): data = json.loads((datadir / "1203206.json").read_text()) record = create_record("con", data=data) record["deleted"] = True record.index(delay=False) current_search.flush_and_refresh("records-conferences") expected_records_count = 0 record_lit_es = ConferencesSearch().get_record(str( record.id)).execute().hits assert expected_records_count == len(record_lit_es)
def test_indexer_deletes_record_from_es(es_clear, db, datadir, create_record): data = json.loads((datadir / "1203206.json").read_text()) record = create_record("con", data=data) record["deleted"] = True record._index() es_clear.indices.refresh("records-conferences") expected_records_count = 0 record_lit_es = ConferencesSearch().get_record(str( record.id)).execute().hits assert expected_records_count == len(record_lit_es)
def test_reindex_all_types_records(inspire_app, cli): record_lit = create_record_factory("lit") record_aut = create_record_factory("aut") record_job = create_record_factory("job") record_con = create_record_factory("con") cli.invoke(["index", "reindex", "--all"]) current_search.flush_and_refresh("*") results_lit_uuid = LiteratureSearch().execute().hits.hits[0]["_id"] results_aut_uuid = AuthorsSearch().execute().hits.hits[0]["_id"] results_con_uuid = ConferencesSearch().execute().hits.hits[0]["_id"] results_job_uuid = JobsSearch().execute().hits.hits[0]["_id"] assert str(record_lit.id) == results_lit_uuid assert str(record_aut.id) == results_aut_uuid assert str(record_con.id) == results_con_uuid assert str(record_job.id) == results_job_uuid
def conferences(): return ConferencesSearch()
def assert_record(): current_search.flush_and_refresh("records-conferences") record_from_es = ConferencesSearch().get_record_data_from_es( conference_1) assert expected_proceedings == record_from_es["proceedings"]
def assert_record(): current_search.flush_and_refresh("records-conferences") record_from_es = ConferencesSearch().get_record_data_from_es( conference_1) assert expected_contributions_count == record_from_es[ "number_of_contributions"]
def assert_record_is_deleted_from_es(): current_search.flush_and_refresh("records-conferences") expected_records_count = 0 record_lit_es = ConferencesSearch().get_record(str( record.id)).execute().hits assert expected_records_count == len(record_lit_es)