author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Tue, 18 Aug 2009 09:25:26 +0200 | |
changeset 2901 | 8f4d495c94c2 |
parent 2813 | 0cf6c8005bf6 |
child 3466 | beabe54a8664 |
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 |
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
4 |
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
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) |
0cf6c8005bf6
R propagate deprecation of CWRegistry.possible_vobjects
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2773
diff
changeset
|
17 |
vaction = [action for action in actions if action.id == '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) |
0cf6c8005bf6
R propagate deprecation of CWRegistry.possible_vobjects
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2773
diff
changeset
|
24 |
self.failUnless([action for action in actions if action.id == '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) |
0cf6c8005bf6
R propagate deprecation of CWRegistry.possible_vobjects
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2773
diff
changeset
|
29 |
self.failIf([action for action in actions if action.id == '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() |