devtools/testlib.py
branchtls-sprint
changeset 1006 92a0601b2523
parent 829 ea092805d8f8
parent 1004 625e59773119
child 1132 96752791c2b6
equal deleted inserted replaced
1005:09ba3cb2a440 1006:92a0601b2523
   246 
   246 
   247 
   247 
   248     def to_test_etypes(self):
   248     def to_test_etypes(self):
   249         return unprotected_entities(self.schema, strict=True)
   249         return unprotected_entities(self.schema, strict=True)
   250     
   250     
   251     def iter_automatic_rsets(self):
   251     def iter_automatic_rsets(self, limit=10):
   252         """generates basic resultsets for each entity type"""
   252         """generates basic resultsets for each entity type"""
   253         etypes = self.to_test_etypes()
   253         etypes = self.to_test_etypes()
   254         for etype in etypes:
   254         for etype in etypes:
   255             yield self.execute('Any X WHERE X is %s' % etype)
   255             yield self.execute('Any X LIMIT %s WHERE X is %s' % (limit, etype))
   256 
   256 
   257         etype1 = etypes.pop()
   257         etype1 = etypes.pop()
   258         etype2 = etypes.pop()
   258         etype2 = etypes.pop()
   259         # test a mixed query (DISTINCT/GROUP to avoid getting duplicate
   259         # test a mixed query (DISTINCT/GROUP to avoid getting duplicate
   260         # X which make muledit view failing for instance (html validation fails
   260         # X which make muledit view failing for instance (html validation fails
   345 class AutomaticWebTest(WebTest):
   345 class AutomaticWebTest(WebTest):
   346     """import this if you wan automatic tests to be ran"""
   346     """import this if you wan automatic tests to be ran"""
   347     ## one each
   347     ## one each
   348     def test_one_each_config(self):
   348     def test_one_each_config(self):
   349         self.auto_populate(1)
   349         self.auto_populate(1)
   350         for rset in self.iter_automatic_rsets():
   350         for rset in self.iter_automatic_rsets(limit=1):
   351             for testargs in self._test_everything_for(rset):
   351             for testargs in self._test_everything_for(rset):
   352                 yield testargs
   352                 yield testargs
   353 
   353 
   354     ## ten each
   354     ## ten each
   355     def test_ten_each_config(self):
   355     def test_ten_each_config(self):
   356         self.auto_populate(10)
   356         self.auto_populate(10)
   357         for rset in self.iter_automatic_rsets():
   357         for rset in self.iter_automatic_rsets(limit=10):
   358             for testargs in self._test_everything_for(rset):
   358             for testargs in self._test_everything_for(rset):
   359                 yield testargs
   359                 yield testargs
   360                 
   360                 
   361     ## startup views
   361     ## startup views
   362     def test_startup_views(self):
   362     def test_startup_views(self):