test_tools.py 2.06 KB
Newer Older
LE GAC Renaud's avatar
LE GAC Renaud committed
1 2 3 4 5
# -*- coding: utf-8 -*-
"""a collection of tools to help tests procedure.

    * Build the complete list of messages
      which can be generated during harvesters.
6 7 8 9 10 11 12 13

"""
from gluon import current

from harvest_tools.articles import (
    MSG_NO_EDITOR,
    MSG_TRANSFORM_PREPRINT)

LE GAC Renaud's avatar
LE GAC Renaud committed
14
from harvest_tools.automaton import MSG_INSERT_FAIL
LE GAC Renaud's avatar
LE GAC Renaud committed
15

16 17 18 19 20 21 22 23 24 25 26 27
from harvest_tools.base import (
    MSG_FIX_ORIGIN,
    MSG_IN_DB,
    MSG_LOAD,
    MSG_NO_ENTRY,
    MSG_TOOMANY_SYNONYM)

from harvest_tools.checkandfix import (
    MSG_NO_AUTHOR,
    MSG_NO_CONF_DATE,
    MSG_NO_DATE,
    MSG_NO_MY_AUTHOR,
LE GAC Renaud's avatar
LE GAC Renaud committed
28
    MSG_NO_OAI,
29 30
    MSG_NO_REF,
    MSG_TEMPORARY_RECORD,
LE GAC Renaud's avatar
LE GAC Renaud committed
31
    MSG_WELL_FORMED_DATE)
32

LE GAC Renaud's avatar
LE GAC Renaud committed
33 34 35 36 37 38
from harvest_tools.preprints import (
    MSG_PREPRINT_IS_PAPER,
    MSG_PREPRINT_IS_CONFERENCE,
    MSG_PREPRINT_IS_THESIS,
    MSG_PREPRINT_NO_NUMBER)

39
from harvest_tools.reports import MSG_REPORT_NO_NUMBER
LE GAC Renaud's avatar
LE GAC Renaud committed
40 41 42 43 44 45 46 47 48

from invenio_tools.base import (
    MSG_INV_CONF,
    MSG_INV_CONF_KEY,
    MSG_NO_CONF,
    MSG_NO_CONF_ID_KEY,
    MSG_NO_COUNTRY,
    MSG_NO_PUBLISHER,
    MSG_WELL_FORMED_COLLABORATION)
49 50 51 52


def messages():
    T = current.T
LE GAC Renaud's avatar
LE GAC Renaud committed
53

54 55 56 57 58
    set_msgs = {
        T(MSG_NO_EDITOR),
        T(MSG_TRANSFORM_PREPRINT),
        T(MSG_FIX_ORIGIN),
        T(MSG_IN_DB),
LE GAC Renaud's avatar
LE GAC Renaud committed
59 60 61
        T(MSG_INV_CONF),
        T(MSG_INV_CONF_KEY),
        T(MSG_INSERT_FAIL),
62
        T(MSG_LOAD),
LE GAC Renaud's avatar
LE GAC Renaud committed
63 64 65
        T(MSG_NO_CONF),
        T(MSG_NO_CONF_ID_KEY),
        T(MSG_NO_COUNTRY),
LE GAC Renaud's avatar
LE GAC Renaud committed
66 67 68
        T(MSG_NO_ENTRY % "collaborations"),
        T(MSG_NO_ENTRY % "countries"),
        T(MSG_NO_ENTRY % "publishers"),
LE GAC Renaud's avatar
LE GAC Renaud committed
69
        T(MSG_NO_OAI),
70 71
        T(MSG_TOOMANY_SYNONYM),
        T(MSG_NO_AUTHOR),
LE GAC Renaud's avatar
LE GAC Renaud committed
72
        T(MSG_NO_CONF),
73 74 75
        T(MSG_NO_CONF_DATE),
        T(MSG_NO_DATE),
        T(MSG_NO_MY_AUTHOR),
LE GAC Renaud's avatar
LE GAC Renaud committed
76
        T(MSG_NO_OAI),
LE GAC Renaud's avatar
LE GAC Renaud committed
77
        T(MSG_NO_PUBLISHER),
78
        T(MSG_NO_REF),
LE GAC Renaud's avatar
LE GAC Renaud committed
79 80 81 82 83
        T(MSG_PREPRINT_IS_PAPER),
        T(MSG_PREPRINT_IS_CONFERENCE),
        T(MSG_PREPRINT_IS_THESIS),
        T(MSG_PREPRINT_NO_NUMBER),
        T(MSG_REPORT_NO_NUMBER),
84
        T(MSG_TEMPORARY_RECORD),
LE GAC Renaud's avatar
LE GAC Renaud committed
85
        T(MSG_WELL_FORMED_COLLABORATION),
LE GAC Renaud's avatar
LE GAC Renaud committed
86
        T(MSG_WELL_FORMED_DATE)}
LE GAC Renaud's avatar
LE GAC Renaud committed
87

88
    return set_msgs