Revision 3ee2b81b
Quelques améliorations pour pylint.
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@1692 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigiboard/controllers/root.py | ||
---|---|---|
218 | 218 |
Event, |
219 | 219 |
).join( |
220 | 220 |
(Event, CorrEvent.idcause == Event.idevent), |
221 |
(ServiceLowLevel, Event.idsupitem == ServiceLowLevel.idservice), |
|
221 |
(ServiceLowLevel, Event.idsupitem == \ |
|
222 |
ServiceLowLevel.idservice), |
|
222 | 223 |
(Host, Host.idhost == ServiceLowLevel.idhost), |
223 |
(HOST_GROUP_TABLE, HOST_GROUP_TABLE.c.idhost == Host.idhost), |
|
224 |
(HOST_GROUP_TABLE, HOST_GROUP_TABLE.c.idhost == \ |
|
225 |
Host.idhost), |
|
224 | 226 |
(SERVICE_GROUP_TABLE, SERVICE_GROUP_TABLE.c.idservice == \ |
225 | 227 |
ServiceLowLevel.idservice), |
226 | 228 |
).filter(HOST_GROUP_TABLE.c.idgroup.in_(user_groups) |
... | ... | |
339 | 341 |
|
340 | 342 |
username = request.environ['repoze.who.identity']['repoze.who.userid'] |
341 | 343 |
events = VigiboardRequest(User.by_user_name(username)) |
342 |
events.add_join((ServiceLowLevel, ServiceLowLevel.idservice == Event.idsupitem)) |
|
344 |
events.add_join((ServiceLowLevel, ServiceLowLevel.idservice == \ |
|
345 |
Event.idsupitem)) |
|
343 | 346 |
events.add_join((Host, ServiceLowLevel.idhost == Host.idhost)) |
344 | 347 |
events.add_filter(Host.name == host, |
345 | 348 |
ServiceLowLevel.servicename == service) |
... | ... | |
418 | 421 |
# page est affichée, on en informe l'utilisateur. |
419 | 422 |
if datetime.fromtimestamp(float(krgv['last_modification'])) \ |
420 | 423 |
< get_last_modification_timestamp(ids): |
421 |
flash(_('Changes have occurred since the page was displayed, ' |
|
422 |
'please refresh it.'), 'warning') |
|
423 |
print "\n\n\n\n ##### ", datetime.fromtimestamp(float(krgv['last_modification'])), " #####" |
|
424 |
print "##### ", get_last_modification_timestamp(ids), "\n\n\n\n" |
|
424 |
flash(_('Changes have occurred since the page was last displayed, ' |
|
425 |
'your changes HAVE NOT been saved.'), 'warning') |
|
425 | 426 |
raise redirect(request.environ.get('HTTP_REFERER', url('/'))) |
426 | 427 |
|
427 | 428 |
# Si l'utilisateur édite plusieurs événements à la fois, |
... | ... | |
466 | 467 |
type_action="Acknowlegement change state", |
467 | 468 |
idevent=event.idcause, |
468 | 469 |
value=krgv['ack'], |
469 |
text=_("Changed acknowledgement status from '%s' to '%s'") % ( |
|
470 |
text=_("Changed acknowledgement status " |
|
471 |
"from '%s' to '%s'") % ( |
|
470 | 472 |
event.status, krgv['ack'] |
471 | 473 |
), |
472 | 474 |
username=username, |
vigiboard/tests/__init__.py | ||
---|---|---|
66 | 66 |
teardown_db() |
67 | 67 |
del self.app |
68 | 68 |
|
69 |
def runtests(args=[]):
|
|
69 |
def runtests(*args):
|
|
70 | 70 |
"""This is the method called when running unit tests.""" |
71 |
# XXX hard-coded path. |
|
72 | 71 |
sys.argv[1:0] = ['--with-pylons', '../vigiboard/test.ini', |
73 | 72 |
'--with-coverage', '--cover-inclusive', |
74 | 73 |
'--cover-erase', '--cover-package', 'vigiboard', |
vigiboard/tests/functional/test_userutils.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
# vim:set expandtab tabstop=4 shiftwidth=4: |
3 | 3 |
""" |
4 |
Test de la classe User Utils
|
|
4 |
Teste l'héritage des permissions sur les groupes d'hôtes/services.
|
|
5 | 5 |
""" |
6 | 6 |
import tg |
7 | 7 |
import transaction |
... | ... | |
10 | 10 |
from vigiboard.model import DBSession, HostGroup, Permission, User |
11 | 11 |
from vigiboard.tests import TestController |
12 | 12 |
|
13 |
class TestUserUtils(TestController):
|
|
13 |
class TestGroupPermissionsInheritance(TestController):
|
|
14 | 14 |
"""Test retrieval of groups of hosts/services.""" |
15 | 15 |
def test_groups_inheritance(self): |
16 | 16 |
""" |
vigiboard/tests/functional/test_vigiboardrequest.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
# vim:set expandtab tabstop=4 shiftwidth=4: |
3 | 3 |
""" |
4 |
Test de la classe Vigiboard Request
|
|
4 |
Tests portant sur la classe VigiboardRequest.
|
|
5 | 5 |
""" |
6 | 6 |
|
7 | 7 |
from nose.tools import assert_true |
... | ... | |
22 | 22 |
"""Test de la classe Vigiboard Request""" |
23 | 23 |
|
24 | 24 |
def setUp(self): |
25 |
"""Création de données pour le test.""" |
|
25 | 26 |
super(TestVigiboardRequest, self).setUp() |
26 | 27 |
|
27 | 28 |
# Les noms d'états. |
... | ... | |
35 | 36 |
# Les groupes et leurs dépendances |
36 | 37 |
self.hosteditors = HostGroup(name=u'editorsgroup') |
37 | 38 |
DBSession.add(self.hosteditors) |
38 |
self.hostmanagers = HostGroup(name=u'managersgroup', parent=self.hosteditors) |
|
39 |
self.hostmanagers = HostGroup(name=u'managersgroup', |
|
40 |
parent=self.hosteditors) |
|
39 | 41 |
DBSession.add(self.hostmanagers) |
40 | 42 |
self.serviceeditors = ServiceGroup(name=u'editorsgroup') |
41 | 43 |
DBSession.add(self.serviceeditors) |
42 |
self.servicemanagers = ServiceGroup(name=u'managersgroup', parent=self.serviceeditors) |
|
44 |
self.servicemanagers = ServiceGroup(name=u'managersgroup', |
|
45 |
parent=self.serviceeditors) |
|
43 | 46 |
DBSession.add(self.servicemanagers) |
44 | 47 |
DBSession.flush() |
45 | 48 |
|
... | ... | |
171 | 174 |
transaction.commit() |
172 | 175 |
|
173 | 176 |
def tearDown(self): |
177 |
"""Destruction des données temporaires du test.""" |
|
174 | 178 |
# This operation is only necessary for DBMS which are |
175 | 179 |
# really strict about table locks, such as PostgreSQL. |
176 | 180 |
# For our tests, we use an (in-memory) SQLite database, |
Also available in: Unified diff