web/test/unittest_views_pyviews.py
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Tue, 21 Jul 2009 12:44:36 +0200
changeset 2400 17b1f0b80fe8
parent 2058 7ef12c03447c
child 2650 18aec79ec3a3
permissions -rw-r--r--
[primary] restore render_entity, as it is a bit too much work to update everything accordingly

from logilab.common.testlib import unittest_main
from cubicweb.devtools.apptest import EnvBasedTC

class PyViewsTC(EnvBasedTC):

    def test_pyvaltable(self):
        content = self.vreg.render('pyvaltable', self.request(),
                                   pyvalue=[[1, 'a'], [2, 'b']],
                                   headers=['num', 'char'])
        self.assertEquals(content.strip(), '''<table class="listing">
<tr><th>num</th><th>char</th></tr>
<tr><td>1</td><td>a</td></tr>
<tr><td>2</td><td>b</td></tr>
</table>''')

    def test_pyvallist(self):
        content = self.vreg.render('pyvallist', self.request(),
                                   pyvalue=[1, 'a'])
        self.assertEquals(content.strip(), '''<ul>
<li>1</li>
<li>a</li>
</ul>''')

if __name__ == '__main__':
    unittest_main()