test_11_CheckAndFix_proceeding.py 1.73 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
# -*- coding: utf-8 -*-
"""test_11_CheckAndFix_proceeding

    * Test CheckAndFix methods for proceeding.
      Use the same proceeding in cds.cern.ch and inspirehep.net

        - is_conference
        - country
        - conference_date

        - submitted

        - format_editor (already test with article)
        - publisher (already test with article)
        - paper_reference (already test with article)

        - format_authors (already test with article)
        - get_my_authors (already test with article)

"""
import pytest
from harvest_tools.checkandfix import CheckAndFix
from invenio_tools import load_record


@pytest.fixture(scope="module")
def reccds():
    return load_record("cds.cern.ch", 1411352)


@pytest.fixture(scope="module")
def recins():
    return load_record("inspirehep.net", 1089237)


@pytest.fixture(scope="module")
def svc():
    return CheckAndFix()


def test_is_conference(svc, reccds, recins):
    assert svc.is_conference(reccds) is None
    assert svc.is_conference(recins) is None


def test_country(svc, reccds, recins):
    assert svc.country(reccds) is None
    assert svc.country(recins) is None


def test_conference_date(svc, reccds, recins):

    assert reccds.conference_dates() == "6 - 11 Dec 2010"
    svc.conference_date(reccds)
    assert reccds.conference_dates() == "06 - 11 Dec 2010"

    assert recins.conference_dates() == "6-11 Dec 2010"
    svc.conference_date(recins)
    assert recins.conference_dates() == "06 - 11 Dec 2010"


def test_submitted(svc, reccds, recins):

    assert reccds.submitted() == "05 Jan 2012"
    svc.submitted(reccds)
    assert reccds.submitted() == "2012-01-05"

    assert recins.submitted() == "2011"
    svc.submitted(recins)
    assert recins.submitted() == "2010-12-06"