[hookstests/base] use connections instead of web requests
authorJulien Cristau <julien.cristau@logilab.fr>
Wed, 02 Jul 2014 18:01:16 +0200
changeset 9853 4ddae5c156f6
parent 9852 4c1969c173fa
child 9854 4071c52b8fca
[hookstests/base] use connections instead of web requests
hooks/test/unittest_hooks.py
--- a/hooks/test/unittest_hooks.py	Wed Jun 04 14:55:07 2014 +0200
+++ b/hooks/test/unittest_hooks.py	Wed Jul 02 18:01:16 2014 +0200
@@ -73,31 +73,31 @@
                                              {'l1': l1, 'l2': l2}))
 
     def test_html_tidy_hook(self):
-        with self.admin_access.web_request() as req:
-            entity = req.create_entity('Workflow', name=u'wf1',
+        with self.admin_access.client_cnx() as cnx:
+            entity = cnx.create_entity('Workflow', name=u'wf1',
                                        description_format=u'text/html',
                                        description=u'yo')
             self.assertEqual(entity.description, u'yo')
-            entity = req.create_entity('Workflow', name=u'wf2',
+            entity = cnx.create_entity('Workflow', name=u'wf2',
                                        description_format=u'text/html',
                                        description=u'<b>yo')
             self.assertEqual(entity.description, u'<b>yo</b>')
-            entity = req.create_entity('Workflow', name=u'wf3',
+            entity = cnx.create_entity('Workflow', name=u'wf3',
                                        description_format=u'text/html',
                                        description=u'<b>yo</b>')
             self.assertEqual(entity.description, u'<b>yo</b>')
-            entity = req.create_entity('Workflow', name=u'wf4',
+            entity = cnx.create_entity('Workflow', name=u'wf4',
                                        description_format=u'text/html',
                                        description=u'<b>R&D</b>')
             self.assertEqual(entity.description, u'<b>R&amp;D</b>')
-            entity = req.create_entity('Workflow', name=u'wf5',
+            entity = cnx.create_entity('Workflow', name=u'wf5',
                                        description_format=u'text/html',
                                        description=u"<div>c&apos;est <b>l'ét&eacute;")
             self.assertEqual(entity.description, u"<div>c'est <b>l'été</b></div>")
 
     def test_nonregr_html_tidy_hook_no_update(self):
-        with self.admin_access.web_request() as req:
-            entity = req.create_entity('Workflow', name=u'wf1',
+        with self.admin_access.client_cnx() as cnx:
+            entity = cnx.create_entity('Workflow', name=u'wf1',
                                        description_format=u'text/html',
                                        description=u'yo')
             entity.cw_set(name=u'wf2')