web/test/unittest_views_pyviews.py
author Nicolas Chauvat <nicolas.chauvat@logilab.fr>
Thu, 28 May 2009 22:57:52 +0200
changeset 1998 12040c090aa4
parent 1987 d495e9ce9367
child 2058 7ef12c03447c
permissions -rw-r--r--
[views] change schema views: remove view eschema and use tabs for cwetype

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

class PyViewsTC(EnvBasedTC):

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

if __name__ == '__main__':
    unittest_main()