author | Nicolas Chauvat <nicolas.chauvat@logilab.fr> |
Wed, 27 May 2009 12:46:20 +0200 | |
branch | stable |
changeset 1957 | 92d1a15f08f7 |
parent 1802 | d628defebc17 |
child 1977 | 606923dff11b |
permissions | -rw-r--r-- |
0 | 1 |
from logilab.common.testlib import unittest_main |
2 |
from cubicweb.devtools.apptest import EnvBasedTC |
|
3 |
||
4 |
class HooksTC(EnvBasedTC): |
|
5 |
||
6 |
def test_euser_login_stripped(self): |
|
7 |
u = self.create_user(' joe ') |
|
8 |
tname = self.execute('Any L WHERE E login L, E eid %(e)s', |
|
9 |
{'e': u.eid})[0][0] |
|
10 |
self.assertEquals(tname, 'joe') |
|
11 |
self.execute('SET X login " jijoe " WHERE X eid %(x)s', {'x': u.eid}) |
|
12 |
tname = self.execute('Any L WHERE E login L, E eid %(e)s', |
|
13 |
{'e': u.eid})[0][0] |
|
14 |
self.assertEquals(tname, 'jijoe') |
|
15 |
||
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
0
diff
changeset
|
16 |
|
0 | 17 |
def test_auto_delete_bookmarks(self): |
18 |
beid = self.execute('INSERT Bookmark X: X title "hop", X path "view", X bookmarked_by U ' |
|
19 |
'WHERE U login "admin"')[0][0] |
|
20 |
self.execute('SET X bookmarked_by U WHERE U login "anon"') |
|
21 |
self.commit() |
|
22 |
self.execute('DELETE X bookmarked_by U WHERE U login "admin"') |
|
23 |
self.commit() |
|
24 |
self.failUnless(self.execute('Any X WHERE X eid %(x)s', {'x': beid}, 'x')) |
|
25 |
self.execute('DELETE X bookmarked_by U WHERE U login "anon"') |
|
26 |
self.commit() |
|
27 |
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
|
28 |
|
0 | 29 |
if __name__ == '__main__': |
30 |
unittest_main() |