author | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> |
Wed, 23 Sep 2009 12:29:31 +0200 | |
changeset 3419 | 32cfd0844243 |
parent 2773 | b2530e3e0afb |
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 |
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
9 |
from cubicweb.devtools.testlib import CubicWebTC |
0 | 10 |
|
2773
b2530e3e0afb
[testlib] #345052 and #344207: major test lib refactoring/cleanup + update usage
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
11 |
class HooksTC(CubicWebTC): |
0 | 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() |