server/test/unittest_querier.py
changeset 6631 26c303c3f1aa
parent 6427 c8a5ac2d1eaa
child 6781 5062d86d6ffe
equal deleted inserted replaced
6630:f516ee1ef36c 6631:26c303c3f1aa
    60         self.assertEqual(make_schema((Variable('A'), Variable('B')), solution,
    60         self.assertEqual(make_schema((Variable('A'), Variable('B')), solution,
    61                                       'table0', TYPEMAP),
    61                                       'table0', TYPEMAP),
    62                           ('C0 text,C1 integer', {'A': 'table0.C0', 'B': 'table0.C1'}))
    62                           ('C0 text,C1 integer', {'A': 'table0.C0', 'B': 'table0.C1'}))
    63 
    63 
    64 
    64 
    65 repo, cnx = init_test_database()
    65 def setup_module(*args):
       
    66     global repo, cnx
       
    67     repo, cnx = init_test_database(apphome=UtilsTC.datadir)
    66 
    68 
    67 def teardown_module(*args):
    69 def teardown_module(*args):
    68     global repo, cnx
    70     global repo, cnx
    69     cnx.close()
    71     cnx.close()
    70     repo.shutdown()
    72     repo.shutdown()
    71     del repo, cnx
    73     del repo, cnx
    72 
    74 
    73 
    75 
    74 class UtilsTC(BaseQuerierTC):
    76 class UtilsTC(BaseQuerierTC):
    75     repo = repo
    77     def setUp(self):
       
    78         self.__class__.repo = repo
       
    79         super(UtilsTC, self).setUp()
    76 
    80 
    77     def get_max_eid(self):
    81     def get_max_eid(self):
    78         # no need for cleanup here
    82         # no need for cleanup here
    79         return None
    83         return None
    80     def cleanup(self):
    84     def cleanup(self):
   223         rset = self.execute('Any %(x)s', {'x': u'str'})
   227         rset = self.execute('Any %(x)s', {'x': u'str'})
   224         self.assertEqual(rset.description[0][0], 'String')
   228         self.assertEqual(rset.description[0][0], 'String')
   225 
   229 
   226 
   230 
   227 class QuerierTC(BaseQuerierTC):
   231 class QuerierTC(BaseQuerierTC):
   228     repo = repo
   232     def setUp(self):
       
   233         self.__class__.repo = repo
       
   234         super(QuerierTC, self).setUp()
   229 
   235 
   230     def test_encoding_pb(self):
   236     def test_encoding_pb(self):
   231         self.assertRaises(RQLSyntaxError, self.execute,
   237         self.assertRaises(RQLSyntaxError, self.execute,
   232                           'Any X WHERE X is CWRType, X name "öwned_by"')
   238                           'Any X WHERE X is CWRType, X name "öwned_by"')
   233 
   239