def test_get_query_records_to_index_only_lit_adding_record( inspire_app, celery_app_with_context, celery_session_worker): generate_records(count=1, data={"deleted": True}) pids = ["lit"] query = get_query_records_to_index(pids) expected_count = 1 # takes ALSO deleted record result_count = query.count() assert result_count == expected_count
def test_get_query_records_to_index_indexes_deleted_record_too( inspire_app, clean_celery_session): generate_records(count=1) generate_records(count=1, data={"deleted": True}) pids = ["lit"] query = get_query_records_to_index(pids) expected_count = 2 result_count = query.count() assert result_count == expected_count
def test_get_query_records_to_index_only_lit(inspire_app, clean_celery_session): generate_records(count=2) generate_records(count=2, record_type=AuthorsRecord) pids = ["lit"] query = get_query_records_to_index(pids) expected_count = 2 result_count = query.count() assert result_count == expected_count uuids = [str(item[0]) for item in query.all()] deleted_records = _get_deleted_records_by_uuids(uuids) assert deleted_records == []
def test_get_query_records_to_index_ok_different_pids(inspire_app, celery_app_with_context, celery_session_worker): generate_records(count=2) generate_records(count=2, record_type=AuthorsRecord) pids = ["lit", "aut"] query = get_query_records_to_index(pids) expected_count = 4 result_count = query.count() assert result_count == expected_count uuids = [str(item[0]) for item in query.all()] deleted_records = _get_deleted_records_by_uuids(uuids) assert deleted_records == []