author | Alexandre Fayolle <alexandre.fayolle@logilab.fr> |
Fri, 23 Apr 2010 12:19:54 +0200 | |
branch | stable |
changeset 5389 | 809d3b5b3d31 |
parent 4252 | 6c4f109c2b03 |
child 5421 | 8167de96c523 |
permissions | -rw-r--r-- |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
1 |
""" |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
2 |
|
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
3 |
:organization: Logilab |
4212
ab6573088b4a
update copyright: welcome 2010
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2650
diff
changeset
|
4 |
:copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
6 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
7 |
""" |
0 | 8 |
from logilab.common.testlib import unittest_main |
9 |
||
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2650
diff
changeset
|
10 |
from cubicweb.devtools.testlib import CubicWebTC |
0 | 11 |
|
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2650
diff
changeset
|
12 |
class ActionsTC(CubicWebTC): |
0 | 13 |
def test_view_action(self): |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
14 |
req = self.request(__message='bla bla bla', vid='rss', rql='CWUser X') |
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
15 |
rset = self.execute('CWUser X') |
2813
0cf6c8005bf6
R propagate deprecation of CWRegistry.possible_vobjects
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2773
diff
changeset
|
16 |
actions = self.vreg['actions'].poss_visible_objects(req, rset=rset) |
3466
beabe54a8664
[tests] make unittest_views_actions pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2813
diff
changeset
|
17 |
vaction = [action for action in actions if action.__regid__ == 'view'][0] |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
0
diff
changeset
|
18 |
self.assertEquals(vaction.url(), 'http://testing.fr/cubicweb/view?rql=CWUser%20X') |
0 | 19 |
|
20 |
def test_sendmail_action(self): |
|
21 |
req = self.request() |
|
22 |
rset = self.execute('Any X WHERE X login "admin"', req=req) |
|
2813
0cf6c8005bf6
R propagate deprecation of CWRegistry.possible_vobjects
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2773
diff
changeset
|
23 |
actions = self.vreg['actions'].poss_visible_objects(req, rset=rset) |
3466
beabe54a8664
[tests] make unittest_views_actions pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2813
diff
changeset
|
24 |
self.failUnless([action for action in actions if action.__regid__ == 'sendemail']) |
0 | 25 |
self.login('anon') |
26 |
req = self.request() |
|
27 |
rset = self.execute('Any X WHERE X login "anon"', req=req) |
|
2813
0cf6c8005bf6
R propagate deprecation of CWRegistry.possible_vobjects
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2773
diff
changeset
|
28 |
actions = self.vreg['actions'].poss_visible_objects(req, rset=rset) |
3466
beabe54a8664
[tests] make unittest_views_actions pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2813
diff
changeset
|
29 |
self.failIf([action for action in actions if action.__regid__ == 'sendemail']) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
30 |
|
0 | 31 |
if __name__ == '__main__': |
32 |
unittest_main() |