--- a/web/test/unittest_views_pyviews.py Mon Jun 02 16:13:33 2014 +0200
+++ b/web/test/unittest_views_pyviews.py Mon Jun 02 16:18:06 2014 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -21,20 +21,22 @@
class PyViewsTC(CubicWebTC):
def test_pyvaltable(self):
- view = self.vreg['views'].select('pyvaltable', self.request(),
- pyvalue=[[1, 'a'], [2, 'b']])
- content = view.render(pyvalue=[[1, 'a'], [2, 'b']],
- headers=['num', 'char'])
- self.assertEqual(content.strip(), '''<table class="listing"><tbody>\
+ with self.admin_access.web_request() as req:
+ view = self.vreg['views'].select('pyvaltable', req,
+ pyvalue=[[1, 'a'], [2, 'b']])
+ content = view.render(pyvalue=[[1, 'a'], [2, 'b']],
+ headers=['num', 'char'])
+ self.assertEqual(content.strip(), '''<table class="listing"><tbody>\
<tr class="even" onmouseout="$(this).removeClass("highlighted")" onmouseover="$(this).addClass("highlighted");"><td >1</td><td >a</td></tr>
<tr class="odd" onmouseout="$(this).removeClass("highlighted")" onmouseover="$(this).addClass("highlighted");"><td >2</td><td >b</td></tr>
</tbody></table>''')
def test_pyvallist(self):
- view = self.vreg['views'].select('pyvallist', self.request(),
- pyvalue=[1, 'a'])
- content = view.render(pyvalue=[1, 'a'])
- self.assertEqual(content.strip(), '''<ul>
+ with self.admin_access.web_request() as req:
+ view = self.vreg['views'].select('pyvallist', req,
+ pyvalue=[1, 'a'])
+ content = view.render(pyvalue=[1, 'a'])
+ self.assertEqual(content.strip(), '''<ul>
<li>1</li>
<li>a</li>
</ul>''')