Exemplo n.º 1
0
 def get_subsidiary_experiments(data):
     query_results = ExperimentsSearch.get_subsidiary_experiments(
         data, source=["legacy_name", "control_number"])
     results = [
         query_result.to_dict()
         for query_result in query_results.execute().hits
         if query_result["legacy_name"]
     ]
     return results
Exemplo n.º 2
0
def test_indexer_deletes_record_from_es(es_clear, db, datadir, create_record):
    data = json.loads((datadir / "1108541.json").read_text())
    record = create_record("exp", data=data)

    record["deleted"] = True
    record._index()
    es_clear.indices.refresh("records-experiments")

    expected_records_count = 0

    record_lit_es = ExperimentsSearch().get_record(str(
        record.id)).execute().hits
    assert expected_records_count == len(record_lit_es)
Exemplo n.º 3
0
def test_indexer_deletes_record_from_es(inspire_app, datadir):
    data = json.loads((datadir / "1108541.json").read_text())
    record = create_record("exp", data=data)

    record["deleted"] = True
    record.index(delay=False)
    current_search.flush_and_refresh("records-experiments")

    expected_records_count = 0

    record_lit_es = ExperimentsSearch().get_record(str(
        record.id)).execute().hits
    assert expected_records_count == len(record_lit_es)
Exemplo n.º 4
0
def experiments():
    return ExperimentsSearch()
Exemplo n.º 5
0
 def assert_record_is_deleted_from_es():
     current_search.flush_and_refresh("records-experiments")
     expected_records_count = 0
     record_lit_es = ExperimentsSearch().get_record(str(
         record.id)).execute().hits
     assert expected_records_count == len(record_lit_es)
Exemplo n.º 6
0
 def assert_record():
     current_search.flush_and_refresh("records-experiments")
     record_from_es = ExperimentsSearch().get_record_data_from_es(
         experiment_1)
     assert expected_number_of_papers == record_from_es["number_of_papers"]