web/test/unittest_views_pyviews.py
changeset 7992 4ff9f25cb06e
parent 6340 470d8e828fda
child 9806 37931aaebcfc
equal deleted inserted replaced
7991:dcc5a4d48122 7992:4ff9f25cb06e
     1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
    23     def test_pyvaltable(self):
    23     def test_pyvaltable(self):
    24         view = self.vreg['views'].select('pyvaltable', self.request(),
    24         view = self.vreg['views'].select('pyvaltable', self.request(),
    25                                          pyvalue=[[1, 'a'], [2, 'b']])
    25                                          pyvalue=[[1, 'a'], [2, 'b']])
    26         content = view.render(pyvalue=[[1, 'a'], [2, 'b']],
    26         content = view.render(pyvalue=[[1, 'a'], [2, 'b']],
    27                               headers=['num', 'char'])
    27                               headers=['num', 'char'])
    28         self.assertEqual(content.strip(), '''<table class="listing">
    28         self.assertEqual(content.strip(), '''<table class="listing"><tbody>\
    29 <thead><tr><th>num</th><th>char</th></tr>
    29 <tr class="even" onmouseout="$(this).removeClass(&quot;highlighted&quot;)" onmouseover="$(this).addClass(&quot;highlighted&quot;);"><td >1</td><td >a</td></tr>
    30 </thead><tbody><tr><td>1</td><td>a</td></tr>
    30 <tr class="odd" onmouseout="$(this).removeClass(&quot;highlighted&quot;)" onmouseover="$(this).addClass(&quot;highlighted&quot;);"><td >2</td><td >b</td></tr>
    31 <tr><td>2</td><td>b</td></tr>
       
    32 </tbody></table>''')
    31 </tbody></table>''')
    33 
    32 
    34     def test_pyvallist(self):
    33     def test_pyvallist(self):
    35         view = self.vreg['views'].select('pyvallist', self.request(),
    34         view = self.vreg['views'].select('pyvallist', self.request(),
    36                                          pyvalue=[1, 'a'])
    35                                          pyvalue=[1, 'a'])