server/test/unittest_session.py
changeset 8561 77ea3eed9946
parent 8555 c747242d22a6
child 8694 d901c36bcfce
--- a/server/test/unittest_session.py	Mon Sep 10 16:25:48 2012 +0200
+++ b/server/test/unittest_session.py	Thu Sep 20 14:50:06 2012 +0200
@@ -18,7 +18,6 @@
 from __future__ import with_statement
 
 from cubicweb.devtools.testlib import CubicWebTC
-from cubicweb.server.session import hooks_control
 
 
 class InternalSessionTC(CubicWebTC):
@@ -36,7 +35,7 @@
         self.assertEqual(session.disabled_hook_categories, set())
         self.assertEqual(session.enabled_hook_categories, set())
         self.assertEqual(len(session._tx_data), 1)
-        with hooks_control(session, session.HOOKS_DENY_ALL, 'metadata'):
+        with session.deny_all_hooks_but('metadata'):
             self.assertEqual(session.hooks_mode, session.HOOKS_DENY_ALL)
             self.assertEqual(session.disabled_hook_categories, set())
             self.assertEqual(session.enabled_hook_categories, set(('metadata',)))
@@ -48,7 +47,7 @@
             self.assertEqual(session.hooks_mode, session.HOOKS_DENY_ALL)
             self.assertEqual(session.disabled_hook_categories, set())
             self.assertEqual(session.enabled_hook_categories, set(('metadata',)))
-            with hooks_control(session, session.HOOKS_ALLOW_ALL, 'integrity'):
+            with session.allow_all_hooks_but('integrity'):
                 self.assertEqual(session.hooks_mode, session.HOOKS_ALLOW_ALL)
                 self.assertEqual(session.disabled_hook_categories, set(('integrity',)))
                 self.assertEqual(session.enabled_hook_categories, set(('metadata',))) # not changed in such case
@@ -65,4 +64,5 @@
 
 
 if __name__ == '__main__':
+    from logilab.common.testlib import unittest_main
     unittest_main()