server/test/unittest_querier.py
branchstable
changeset 8347 d317a2880059
parent 8343 6bd8db130476
child 8348 1a88d201675c
equal deleted inserted replaced
8346:97fd81357d1d 8347:d317a2880059
    70         self.assertEqual(make_schema((Variable('A'), Variable('B')), solution,
    70         self.assertEqual(make_schema((Variable('A'), Variable('B')), solution,
    71                                       'table0', TYPEMAP),
    71                                       'table0', TYPEMAP),
    72                           ('C0 text,C1 integer', {'A': 'table0.C0', 'B': 'table0.C1'}))
    72                           ('C0 text,C1 integer', {'A': 'table0.C0', 'B': 'table0.C1'}))
    73 
    73 
    74 
    74 
    75 def setUpModule(*args):
    75 def setUpClass(cls, *args):
    76     global repo, cnx
    76     global repo, cnx
    77     config = TestServerConfiguration(apphome=UtilsTC.datadir)
    77     config = TestServerConfiguration(apphome=UtilsTC.datadir)
    78     handler = get_test_db_handler(config)
    78     handler = get_test_db_handler(config)
    79     handler.build_db_cache()
    79     handler.build_db_cache()
    80     repo, cnx = handler.get_repo_and_cnx()
    80     repo, cnx = handler.get_repo_and_cnx()
    81 
    81     cls.repo = repo
    82 def tearDownModule(*args):
    82 
       
    83 def tearDownClass(cls, *args):
    83     global repo, cnx
    84     global repo, cnx
    84     cnx.close()
    85     cnx.close()
    85     repo.shutdown()
    86     repo.shutdown()
    86     del repo, cnx
    87     del repo, cnx
    87 
    88 
    88 
    89 
    89 class UtilsTC(BaseQuerierTC):
    90 class UtilsTC(BaseQuerierTC):
    90     def setUp(self):
    91     setUpClass = classmethod(setUpClass)
    91         self.__class__.repo = repo
    92     tearDownClass = classmethod(tearDownClass)
    92         super(UtilsTC, self).setUp()
       
    93 
    93 
    94     def get_max_eid(self):
    94     def get_max_eid(self):
    95         # no need for cleanup here
    95         # no need for cleanup here
    96         return None
    96         return None
    97     def cleanup(self):
    97     def cleanup(self):
   241         rset = self.execute('Any %(x)s', {'x': u'str'})
   241         rset = self.execute('Any %(x)s', {'x': u'str'})
   242         self.assertEqual(rset.description[0][0], 'String')
   242         self.assertEqual(rset.description[0][0], 'String')
   243 
   243 
   244 
   244 
   245 class QuerierTC(BaseQuerierTC):
   245 class QuerierTC(BaseQuerierTC):
   246     def setUp(self):
   246     setUpClass = classmethod(setUpClass)
   247         self.__class__.repo = repo
   247     tearDownClass = classmethod(tearDownClass)
   248         super(QuerierTC, self).setUp()
       
   249 
   248 
   250     def test_encoding_pb(self):
   249     def test_encoding_pb(self):
   251         self.assertRaises(RQLSyntaxError, self.execute,
   250         self.assertRaises(RQLSyntaxError, self.execute,
   252                           'Any X WHERE X is CWRType, X name "öwned_by"')
   251                           'Any X WHERE X is CWRType, X name "öwned_by"')
   253 
   252