server/test/unittest_rql2sql.py
branchstable
changeset 1862 94dc8ccd320b
parent 1787 71c143c0ada3
child 1977 606923dff11b
equal deleted inserted replaced
1861:21fae1546ac4 1862:94dc8ccd320b
       
     1 
     1 """unit tests for module cubicweb.server.sources.rql2sql"""
     2 """unit tests for module cubicweb.server.sources.rql2sql"""
     2 
     3 
     3 import sys
     4 import sys
     4 
     5 
     5 from logilab.common.testlib import TestCase, unittest_main
     6 from logilab.common.testlib import TestCase, unittest_main
  1209                     '''SELECT T00.x, T00.l, G.cw_name
  1210                     '''SELECT T00.x, T00.l, G.cw_name
  1210 FROM T00, cw_CWGroup AS G, in_group_relation AS rel_in_group0
  1211 FROM T00, cw_CWGroup AS G, in_group_relation AS rel_in_group0
  1211 WHERE rel_in_group0.eid_from=T00.x AND rel_in_group0.eid_to=G.cw_eid''',
  1212 WHERE rel_in_group0.eid_from=T00.x AND rel_in_group0.eid_to=G.cw_eid''',
  1212                     varmap={'X': 'T00.x', 'X.login': 'T00.l'})
  1213                     varmap={'X': 'T00.x', 'X.login': 'T00.l'})
  1213 
  1214 
       
  1215     def test_is_null_transform(self):
       
  1216         union = self._prepare('Any X WHERE X login %(login)s')
       
  1217         r, args = self.o.generate(union, {'login': None})
       
  1218         self.assertLinesEquals((r % args).strip(),
       
  1219                                '''SELECT X.cw_eid
       
  1220 FROM cw_CWUser AS X
       
  1221 WHERE X.cw_login IS NULL''')
       
  1222 
  1214     def test_parser_parse(self):
  1223     def test_parser_parse(self):
  1215         for t in self._parse(PARSER):
  1224         for t in self._parse(PARSER):
  1216             yield t
  1225             yield t
  1217 
  1226 
  1218     def test_basic_parse(self):
  1227     def test_basic_parse(self):