author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Thu, 15 Apr 2010 18:47:37 +0200 | |
changeset 5297 | cc747dcef851 |
parent 5223 | 6abd6e3599f4 |
child 5423 | e15abfdcce38 |
permissions | -rw-r--r-- |
4051
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
1 |
""" |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
2 |
|
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
3 |
:organization: Logilab |
5223
6abd6e3599f4
#773448: refactor session and 'no connection' handling, by introducing proper web session. We should now be able to see page even when no anon is configured, and be redirected to the login form as soon as one tries to do a query.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4051
diff
changeset
|
4 |
:copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
4051
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
6 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
7 |
""" |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
8 |
from logilab.common.testlib import unittest_main |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
9 |
from cubicweb.devtools.testlib import CubicWebTC |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
10 |
|
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
11 |
class BookmarkHooksTC(CubicWebTC): |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
12 |
|
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
13 |
|
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
14 |
def test_auto_delete_bookmarks(self): |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
15 |
beid = self.execute('INSERT Bookmark X: X title "hop", X path "view", X bookmarked_by U ' |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
16 |
'WHERE U login "admin"')[0][0] |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
17 |
self.execute('SET X bookmarked_by U WHERE U login "anon"') |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
18 |
self.commit() |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
19 |
self.execute('DELETE X bookmarked_by U WHERE U login "admin"') |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
20 |
self.commit() |
5223
6abd6e3599f4
#773448: refactor session and 'no connection' handling, by introducing proper web session. We should now be able to see page even when no anon is configured, and be redirected to the login form as soon as one tries to do a query.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4051
diff
changeset
|
21 |
self.failUnless(self.execute('Any X WHERE X eid %(x)s', {'x': beid})) |
4051
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
22 |
self.execute('DELETE X bookmarked_by U WHERE U login "anon"') |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
23 |
self.commit() |
5223
6abd6e3599f4
#773448: refactor session and 'no connection' handling, by introducing proper web session. We should now be able to see page even when no anon is configured, and be redirected to the login form as soon as one tries to do a query.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4051
diff
changeset
|
24 |
self.failIf(self.execute('Any X WHERE X eid %(x)s', {'x': beid})) |
4051
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
25 |
|
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
26 |
if __name__ == '__main__': |
eec34250a645
move hook tests to hooks package tests
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff
changeset
|
27 |
unittest_main() |