test_tools.py 2.24 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,
31 32 33
    MSG_UNKNOWN_COLLABORATION,
    MSG_UNKNOWN_COUNTRY,
    MSG_UNKNOWN_PUBLISHER,
LE GAC Renaud's avatar
LE GAC Renaud committed
34
    MSG_WELL_FORMED_DATE)
35

LE GAC Renaud's avatar
LE GAC Renaud committed
36 37 38 39 40 41
from harvest_tools.preprints import (
    MSG_PREPRINT_IS_PAPER,
    MSG_PREPRINT_IS_CONFERENCE,
    MSG_PREPRINT_IS_THESIS,
    MSG_PREPRINT_NO_NUMBER)

42
from harvest_tools.reports import MSG_REPORT_NO_NUMBER
LE GAC Renaud's avatar
LE GAC Renaud committed
43 44 45 46 47 48 49 50 51

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)
52 53 54 55


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

57 58 59 60 61
    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
62 63 64
        T(MSG_INV_CONF),
        T(MSG_INV_CONF_KEY),
        T(MSG_INSERT_FAIL),
65
        T(MSG_LOAD),
LE GAC Renaud's avatar
LE GAC Renaud committed
66 67 68
        T(MSG_NO_CONF),
        T(MSG_NO_CONF_ID_KEY),
        T(MSG_NO_COUNTRY),
LE GAC Renaud's avatar
LE GAC Renaud committed
69 70 71
        T(MSG_NO_ENTRY % "collaborations"),
        T(MSG_NO_ENTRY % "countries"),
        T(MSG_NO_ENTRY % "publishers"),
LE GAC Renaud's avatar
LE GAC Renaud committed
72
        T(MSG_NO_OAI),
73 74
        T(MSG_TOOMANY_SYNONYM),
        T(MSG_NO_AUTHOR),
LE GAC Renaud's avatar
LE GAC Renaud committed
75
        T(MSG_NO_CONF),
76 77 78
        T(MSG_NO_CONF_DATE),
        T(MSG_NO_DATE),
        T(MSG_NO_MY_AUTHOR),
LE GAC Renaud's avatar
LE GAC Renaud committed
79
        T(MSG_NO_OAI),
LE GAC Renaud's avatar
LE GAC Renaud committed
80
        T(MSG_NO_PUBLISHER),
81
        T(MSG_NO_REF),
LE GAC Renaud's avatar
LE GAC Renaud committed
82 83 84 85 86
        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),
87
        T(MSG_TEMPORARY_RECORD),
88 89 90
        T(MSG_UNKNOWN_COLLABORATION),
        T(MSG_UNKNOWN_COUNTRY),
        T(MSG_UNKNOWN_PUBLISHER),
LE GAC Renaud's avatar
LE GAC Renaud committed
91
        T(MSG_WELL_FORMED_COLLABORATION),
LE GAC Renaud's avatar
LE GAC Renaud committed
92
        T(MSG_WELL_FORMED_DATE)}
LE GAC Renaud's avatar
LE GAC Renaud committed
93

94
    return set_msgs