Exemple #1
0
def test_process_references_in_records_doesnt_call_batch_reindex_if_there_are_no_references(
    batch_index_mock, inspire_app
):
    data = {
        "$schema": "http://localhost:5000/schemas/records/hep.json",
        "titles": [{"title": "Test a valid record"}],
        "document_type": ["article"],
        "_collections": ["Literature"],
    }
    record = LiteratureRecord.create(data)
    process_references_in_records([record.id])
    batch_index_mock.assert_not_called()
Exemple #2
0
def test_process_references_in_records_doesnt_call_get_modified_references_for_non_lit_records(
    get_modified_references_mock, inspire_app
):
    data = {
        "$schema": "https://inspire/schemas/records/authors.json",
        "_collections": ["Authors"],
        "name": {"value": "Doe, John"},
    }
    record = InspireRecord.create(data)
    process_references_in_records([record.id])
    get_modified_references_mock.assert_not_called()

    data = {
        "$schema": "http://localhost:5000/schemas/records/hep.json",
        "titles": [{"title": "Test a valid record"}],
        "document_type": ["article"],
        "_collections": ["Literature"],
    }
    record = InspireRecord.create(data)
    process_references_in_records([record.id])
    assert get_modified_references_mock.call_count == 1