web/test/unittest_views_pyviews.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 17 Sep 2009 17:05:58 +0200
branch3.5
changeset 3295 7e5d0ae8d202
parent 2650 18aec79ec3a3
child 2773 b2530e3e0afb
permissions -rw-r--r--
Added tag cubicweb-version-3.5.0 for changeset 70c0dd1c3b7d

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

class PyViewsTC(EnvBasedTC):

    def test_pyvaltable(self):
        content = self.vreg['views'].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['views'].render('pyvallist', self.request(),
                                            pyvalue=[1, 'a'])
        self.assertEquals(content.strip(), '''<ul>
<li>1</li>
<li>a</li>
</ul>''')

if __name__ == '__main__':
    unittest_main()