devtools/testlib.py
branchtls-sprint
changeset 1773 789ee507a8e0
parent 1605 b239744627c7
child 1775 f450f1594992
equal deleted inserted replaced
1772:21d1db460cdb 1773:789ee507a8e0
   192         if rset is not None:
   192         if rset is not None:
   193             self.set_description("testing %s, mod=%s (%s)" % (vid, view.__module__, rset.printable_rql()))
   193             self.set_description("testing %s, mod=%s (%s)" % (vid, view.__module__, rset.printable_rql()))
   194         else:
   194         else:
   195             self.set_description("testing %s, mod=%s (no rset)" % (vid, view.__module__))
   195             self.set_description("testing %s, mod=%s (no rset)" % (vid, view.__module__))
   196         if template is None: # raw view testing, no template
   196         if template is None: # raw view testing, no template
   197             viewfunc = view.dispatch
   197             viewfunc = view.render
   198         else:
   198         else:
   199             templateview = self.vreg.select_view(template, req, rset, view=view, **kwargs)
   199             templateview = self.vreg.select_view(template, req, rset, view=view, **kwargs)
   200             kwargs['view'] = view
   200             kwargs['view'] = view
   201             viewfunc = lambda **k: self.vreg.main_template(req, template, **kwargs)
   201             viewfunc = lambda **k: self.vreg.main_template(req, template, **kwargs)
   202         return self._test_view(viewfunc, view, template, kwargs)
   202         return self._test_view(viewfunc, view, template, kwargs)
   325             # resultset's syntax tree
   325             # resultset's syntax tree
   326             rset = backup_rset
   326             rset = backup_rset
   327         for action in self.list_actions_for(rset):
   327         for action in self.list_actions_for(rset):
   328             yield InnerTest(self._testname(rset, action.id, 'action'), action.url)
   328             yield InnerTest(self._testname(rset, action.id, 'action'), action.url)
   329         for box in self.list_boxes_for(rset):
   329         for box in self.list_boxes_for(rset):
   330             yield InnerTest(self._testname(rset, box.id, 'box'), box.dispatch)
   330             yield InnerTest(self._testname(rset, box.id, 'box'), box.render)
   331 
   331 
   332     @staticmethod
   332     @staticmethod
   333     def _testname(rset, objid, objtype):
   333     def _testname(rset, objid, objtype):
   334         return '%s_%s_%s' % ('_'.join(rset.column_types(0)), objid, objtype)
   334         return '%s_%s_%s' % ('_'.join(rset.column_types(0)), objid, objtype)
   335 
   335