hooks/test/unittest_bookmarks.py
changeset 4051 eec34250a645
child 5223 6abd6e3599f4
child 5421 8167de96c523
equal deleted inserted replaced
4050:f2e1bb4b7536 4051:eec34250a645
       
     1 """
       
     2 
       
     3 :organization: Logilab
       
     4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
       
     5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
       
     6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
       
     7 """
       
     8 from logilab.common.testlib import unittest_main
       
     9 from cubicweb.devtools.testlib import CubicWebTC
       
    10 
       
    11 class BookmarkHooksTC(CubicWebTC):
       
    12 
       
    13 
       
    14     def test_auto_delete_bookmarks(self):
       
    15         beid = self.execute('INSERT Bookmark X: X title "hop", X path "view", X bookmarked_by U '
       
    16                             'WHERE U login "admin"')[0][0]
       
    17         self.execute('SET X bookmarked_by U WHERE U login "anon"')
       
    18         self.commit()
       
    19         self.execute('DELETE X bookmarked_by U WHERE U login "admin"')
       
    20         self.commit()
       
    21         self.failUnless(self.execute('Any X WHERE X eid %(x)s', {'x': beid}, 'x'))
       
    22         self.execute('DELETE X bookmarked_by U WHERE U login "anon"')
       
    23         self.commit()
       
    24         self.failIf(self.execute('Any X WHERE X eid %(x)s', {'x': beid}, 'x'))
       
    25 
       
    26 if __name__ == '__main__':
       
    27     unittest_main()