author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Mon, 06 Jul 2009 14:52:05 +0200 | |
branch | stable |
changeset 2285 | 1cf9e44e2f1f |
parent 1977 | 606923dff11b |
child 2773 | b2530e3e0afb |
child 4212 | ab6573088b4a |
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 |
from cubicweb.devtools.apptest import EnvBasedTC |
|
10 |
||
11 |
class HooksTC(EnvBasedTC): |
|
12 |
||
13 |
def test_euser_login_stripped(self): |
|
14 |
u = self.create_user(' joe ') |
|
15 |
tname = self.execute('Any L WHERE E login L, E eid %(e)s', |
|
16 |
{'e': u.eid})[0][0] |
|
17 |
self.assertEquals(tname, 'joe') |
|
18 |
self.execute('SET X login " jijoe " WHERE X eid %(x)s', {'x': u.eid}) |
|
19 |
tname = self.execute('Any L WHERE E login L, E eid %(e)s', |
|
20 |
{'e': u.eid})[0][0] |
|
21 |
self.assertEquals(tname, 'jijoe') |
|
22 |
||
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
23 |
|
0 | 24 |
def test_auto_delete_bookmarks(self): |
25 |
beid = self.execute('INSERT Bookmark X: X title "hop", X path "view", X bookmarked_by U ' |
|
26 |
'WHERE U login "admin"')[0][0] |
|
27 |
self.execute('SET X bookmarked_by U WHERE U login "anon"') |
|
28 |
self.commit() |
|
29 |
self.execute('DELETE X bookmarked_by U WHERE U login "admin"') |
|
30 |
self.commit() |
|
31 |
self.failUnless(self.execute('Any X WHERE X eid %(x)s', {'x': beid}, 'x')) |
|
32 |
self.execute('DELETE X bookmarked_by U WHERE U login "anon"') |
|
33 |
self.commit() |
|
34 |
self.failIf(self.execute('Any X WHERE X eid %(x)s', {'x': beid}, 'x')) |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
35 |
|
0 | 36 |
if __name__ == '__main__': |
37 |
unittest_main() |