skeleton/test/realdb_test_CUBENAME.py
changeset 0 b97547f5f1fa
child 1802 d628defebc17
equal deleted inserted replaced
-1:000000000000 0:b97547f5f1fa
       
     1 from cubicweb.devtools import buildconfig, loadconfig
       
     2 from cubicweb.devtools.testlib import RealDBTest
       
     3 
       
     4 def setup_module(options):
       
     5     if options.source:
       
     6         configcls = loadconfig(options.source)
       
     7     elif options.dbname is None:
       
     8         raise Exception('either <sourcefile> or <dbname> options are required')
       
     9     else:
       
    10         configcls = buildconfig(options.dbuser, options.dbpassword,
       
    11                                                options.dbname, options.euser,
       
    12                                                options.epassword)
       
    13     RealDatabaseTC.configcls = configcls
       
    14 
       
    15 class RealDatabaseTC(RealDBTest):
       
    16     configcls = None # set by setup_module()
       
    17 
       
    18     def test_all_primaries(self):
       
    19         for rset in self.iter_individual_rsets(limit=50):
       
    20             yield self.view, 'primary', rset, rset.req.reset_headers()
       
    21     
       
    22     ## startup views
       
    23     def test_startup_views(self):
       
    24         for vid in self.list_startup_views():
       
    25             req = self.request()
       
    26             yield self.view, vid, None, req
       
    27 
       
    28 
       
    29 if __name__ == '__main__':
       
    30     from logilab.common.testlib import unittest_main
       
    31     unittest_main()