automatically tests all Mayan apps that report to have tests. Change the app flag that indicates when an app has test from 'test' to the more explicit 'has_test'. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
65 lines
1.8 KiB
Python
65 lines
1.8 KiB
Python
from __future__ import unicode_literals
|
|
|
|
from kombu import Exchange, Queue
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from mayan.celery import app
|
|
from common import MayanAppConfig, menu_object, menu_secondary, menu_tools
|
|
|
|
from navigation import SourceColumn
|
|
|
|
from .classes import Statistic, StatisticNamespace
|
|
from .links import (
|
|
link_execute, link_namespace_details, link_namespace_list,
|
|
link_statistics, link_view
|
|
)
|
|
from .licenses import * # NOQA
|
|
from .tasks import task_execute_statistic # NOQA - Force registration of task
|
|
|
|
|
|
class StatisticsApp(MayanAppConfig):
|
|
has_tests = True
|
|
name = 'statistics'
|
|
verbose_name = _('Statistics')
|
|
|
|
def ready(self):
|
|
super(StatisticsApp, self).ready()
|
|
|
|
SourceColumn(
|
|
source=Statistic,
|
|
# Translators: Schedule here is a verb, the 'schedule' at which the
|
|
# statistic will be updated
|
|
label=_('Schedule'),
|
|
attribute='schedule',
|
|
)
|
|
|
|
app.conf.CELERY_QUEUES.extend(
|
|
(
|
|
Queue(
|
|
'statistics', Exchange('statistics'),
|
|
routing_key='statistics', delivery_mode=1
|
|
),
|
|
)
|
|
)
|
|
|
|
app.conf.CELERY_ROUTES.update(
|
|
{
|
|
'statistics.tasks.task_execute_statistic': {
|
|
'queue': 'statistics'
|
|
},
|
|
}
|
|
)
|
|
|
|
menu_object.bind_links(
|
|
links=(link_execute, link_view), sources=(Statistic,)
|
|
)
|
|
menu_object.bind_links(
|
|
links=(link_namespace_details,), sources=(StatisticNamespace,)
|
|
)
|
|
menu_secondary.bind_links(
|
|
links=(link_namespace_list,),
|
|
sources=(StatisticNamespace, 'statistics:namespace_list')
|
|
)
|
|
menu_tools.bind_links(links=(link_statistics,))
|