test_tools.py 2.51 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 15 16 17
from harvest_tools.automaton import (
    MSG_INSERT_FAIL,
    MSG_WELL_FORM_OAI)

18 19 20 21 22 23 24 25 26 27 28 29
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
30
    MSG_NO_OAI,
31 32 33 34 35 36 37 38 39 40
    MSG_NO_REF,
    MSG_NO_YEAR,
    MSG_TEMPORARY_RECORD,
    MSG_TO_MANY_DATE,
    MSG_TO_MANY_FAUTHOR,
    MSG_TO_MANY_YEAR,
    MSG_WELL_FORMED_CONF_DATES,
    MSG_WELL_FORMED_DATE,
    MSG_WELL_FORMED_EDITOR)

LE GAC Renaud's avatar
LE GAC Renaud committed
41 42 43 44 45 46
from harvest_tools.preprints import (
    MSG_PREPRINT_IS_PAPER,
    MSG_PREPRINT_IS_CONFERENCE,
    MSG_PREPRINT_IS_THESIS,
    MSG_PREPRINT_NO_NUMBER)

47 48
from harvest_tools.reports import MSG_REPORT_NO_NUMBER
from harvest_tools.thesis import MSG_NO_THESIS
LE GAC Renaud's avatar
LE GAC Renaud committed
49 50 51 52 53 54 55 56 57

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)
58 59 60 61


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

63 64 65 66 67
    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
68 69 70
        T(MSG_INV_CONF),
        T(MSG_INV_CONF_KEY),
        T(MSG_INSERT_FAIL),
71
        T(MSG_LOAD),
LE GAC Renaud's avatar
LE GAC Renaud committed
72 73 74
        T(MSG_NO_CONF),
        T(MSG_NO_CONF_ID_KEY),
        T(MSG_NO_COUNTRY),
LE GAC Renaud's avatar
LE GAC Renaud committed
75 76 77
        T(MSG_NO_ENTRY % "collaborations"),
        T(MSG_NO_ENTRY % "countries"),
        T(MSG_NO_ENTRY % "publishers"),
LE GAC Renaud's avatar
LE GAC Renaud committed
78
        T(MSG_NO_OAI),
79 80
        T(MSG_TOOMANY_SYNONYM),
        T(MSG_NO_AUTHOR),
LE GAC Renaud's avatar
LE GAC Renaud committed
81
        T(MSG_NO_CONF),
82 83 84
        T(MSG_NO_CONF_DATE),
        T(MSG_NO_DATE),
        T(MSG_NO_MY_AUTHOR),
LE GAC Renaud's avatar
LE GAC Renaud committed
85
        T(MSG_NO_OAI),
LE GAC Renaud's avatar
LE GAC Renaud committed
86
        T(MSG_NO_PUBLISHER),
87
        T(MSG_NO_REF),
LE GAC Renaud's avatar
LE GAC Renaud committed
88
        T(MSG_NO_THESIS),
89
        T(MSG_NO_YEAR),
LE GAC Renaud's avatar
LE GAC Renaud committed
90 91 92 93 94
        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),
95 96 97 98
        T(MSG_TEMPORARY_RECORD),
        T(MSG_TO_MANY_DATE),
        T(MSG_TO_MANY_FAUTHOR),
        T(MSG_TO_MANY_YEAR),
LE GAC Renaud's avatar
LE GAC Renaud committed
99
        T(MSG_WELL_FORMED_COLLABORATION),
100 101
        T(MSG_WELL_FORMED_CONF_DATES),
        T(MSG_WELL_FORMED_DATE),
LE GAC Renaud's avatar
LE GAC Renaud committed
102 103
        T(MSG_WELL_FORMED_EDITOR),
        T(MSG_WELL_FORM_OAI)}
LE GAC Renaud's avatar
LE GAC Renaud committed
104

105
    return set_msgs