test_recovery_mechanism.py 605 Bytes
Newer Older
1
# -*- coding: utf-8 -*-
2
"""CheckAndfix non conformities
3

4
Test some of the recovery mechanisms implement in the CheckAndFix class.
5 6 7 8

"""
import pytest

9

LE GAC Renaud's avatar
LE GAC Renaud committed
10
from harvest_tools import CheckAndFix
11
from invenio_tools import load_record
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26


def test_clean_erratum():
    record = load_record('inspirehep.net', 1268647)

    assert record.is_with_erratum()
    assert record.paper_year() == ["2014", "2015"]
    assert record.year() == "2014"

    svc = CheckAndFix()
    svc.clean_erratum(record)

    assert isinstance(record["773"], dict)
    assert record.paper_year() == "2014"
    assert record.year() == "2014"