web/test/test_views.py
branchtls-sprint
changeset 1802 d628defebc17
parent 1398 5fe84a5f7035
child 1977 606923dff11b
equal deleted inserted replaced
1801:672acc730ce5 1802:d628defebc17
    20 
    20 
    21 
    21 
    22 
    22 
    23 class SomeView(AnyRsetView):
    23 class SomeView(AnyRsetView):
    24     id = 'someview'
    24     id = 'someview'
    25     
    25 
    26     def call(self):
    26     def call(self):
    27         self.req.add_js('spam.js')
    27         self.req.add_js('spam.js')
    28         self.req.add_js('spam.js')
    28         self.req.add_js('spam.js')
    29 
    29 
    30 
    30 
    32     def setup_database(self):
    32     def setup_database(self):
    33         self.auto_populate(10)
    33         self.auto_populate(10)
    34 
    34 
    35     def test_manual_tests(self):
    35     def test_manual_tests(self):
    36         rset = self.execute('Any P,F,S WHERE P is CWUser, P firstname F, P surname S')
    36         rset = self.execute('Any P,F,S WHERE P is CWUser, P firstname F, P surname S')
    37         self.view('table', rset, template=None, displayfilter=True, displaycols=[0,2])        
    37         self.view('table', rset, template=None, displayfilter=True, displaycols=[0,2])
    38 
    38 
    39     def test_sortable_js_added(self):
    39     def test_sortable_js_added(self):
    40         rset = self.execute('CWUser X')
    40         rset = self.execute('CWUser X')
    41         # sortable.js should not be included by default
    41         # sortable.js should not be included by default
    42         self.failIf('jquery.tablesorter.js' in self.view('oneline', rset))
    42         self.failIf('jquery.tablesorter.js' in self.view('oneline', rset))
    52         self.assertEquals(source.count('spam.js'), 1)
    52         self.assertEquals(source.count('spam.js'), 1)
    53 
    53 
    54 
    54 
    55 
    55 
    56 class ExplicitViewsTest(WebTest):
    56 class ExplicitViewsTest(WebTest):
    57     
    57 
    58     def test_unrelateddivs(self):
    58     def test_unrelateddivs(self):
    59         rset = self.execute('Any X WHERE X is CWUser, X login "admin"')
    59         rset = self.execute('Any X WHERE X is CWUser, X login "admin"')
    60         group = self.add_entity('CWGroup', name=u'R&D')
    60         group = self.add_entity('CWGroup', name=u'R&D')
    61         req = self.request(relation='in_group_subject')
    61         req = self.request(relation='in_group_subject')
    62         self.view('unrelateddivs', rset, req)
    62         self.view('unrelateddivs', rset, req)
    63         
    63 
    64         
       
    65 
    64 
    66 if __name__ == '__main__':
    65 if __name__ == '__main__':
    67     from logilab.common.testlib import unittest_main
    66     from logilab.common.testlib import unittest_main
    68     unittest_main()
    67     unittest_main()