def test_indexer_deletes_record_from_es(inspire_app, datadir): data = json.loads((datadir / "1213103.json").read_text()) record = create_record("jou", data=data) record["deleted"] = True record.index(delay=False) current_search.flush_and_refresh("records-journals") expected_records_count = 0 record_lit_es = JournalsSearch().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 / "1213103.json").read_text()) record = create_record("jou", data=data) record["deleted"] = True record._index() es_clear.indices.refresh("records-journals") expected_records_count = 0 record_lit_es = JournalsSearch().get_record(str(record.id)).execute().hits assert expected_records_count == len(record_lit_es)
def test_journal_title_normalization_without_match(inspire_app): create_record( "jou", data={ "journal_title": { "title": "Physical Review Accelerators and Beams" }, "short_title": "Phys.Rev.Accel.Beams", }, ) journal_title = "Something else" result_journal_title = JournalsSearch().normalize_title(journal_title) assert journal_title == result_journal_title
def test_journal_title_normalization_with_multiple_spaces(inspire_app): create_record( "jou", data={ "journal_title": { "title": "Nucl Phys B" }, "short_title": "Nucl.Phys.B" }, ) journal_title = "Nucl. Phys. B" expected_journal_title = "Nucl.Phys.B" result_journal_title = JournalsSearch().normalize_title(journal_title) assert expected_journal_title == result_journal_title
def test_journal_title_normalization(inspire_app): create_record( "jou", data={ "journal_title": { "title": "Physical Review Accelerators and Beams" }, "short_title": "Phys.Rev.Accel.Beams", }, ) journal_title = "Physical Review Accelerators and Beams" expected_journal_title = "Phys.Rev.Accel.Beams" result_journal_title = JournalsSearch().normalize_title(journal_title) assert expected_journal_title == result_journal_title
def assert_record_is_deleted_from_es(): current_search.flush_and_refresh("records-journals") expected_records_count = 0 record_lit_es = JournalsSearch().get_record(str(record.id)).execute().hits assert expected_records_count == len(record_lit_es)