server/test/unittest_rql2sql.py
changeset 8109 67d540b7f8c8
parent 7907 08320697ca1a
child 8217 0a467663c3fe
equal deleted inserted replaced
8105:7980b36fb1aa 8109:67d540b7f8c8
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """unit tests for module cubicweb.server.sources.rql2sql"""
    18 """unit tests for module cubicweb.server.sources.rql2sql"""
    19 
    19 
    20 import sys
    20 import sys
    21 import os
    21 import os
    22 
    22 from datetime import date
    23 from logilab.common.testlib import TestCase, unittest_main, mock_object
    23 from logilab.common.testlib import TestCase, unittest_main, mock_object
    24 
    24 
    25 from rql import BadRQLQuery
    25 from rql import BadRQLQuery
    26 from rql.utils import register_function, FunctionDescr
    26 from rql.utils import register_function, FunctionDescr
    27 
    27 
  1745 
  1745 
  1746 
  1746 
  1747 class SqlServer2005SQLGeneratorTC(PostgresSQLGeneratorTC):
  1747 class SqlServer2005SQLGeneratorTC(PostgresSQLGeneratorTC):
  1748     backend = 'sqlserver2005'
  1748     backend = 'sqlserver2005'
  1749     def _norm_sql(self, sql):
  1749     def _norm_sql(self, sql):
  1750         return sql.strip().replace(' SUBSTR', ' SUBSTRING').replace(' || ', ' + ').replace(' ILIKE ', ' LIKE ').replace('TRUE', '1').replace('FALSE', '0')
  1750         return sql.strip().replace(' SUBSTR', ' SUBSTRING').replace(' || ', ' + ').replace(' ILIKE ', ' LIKE ').replace('TRUE', '1').replace('FALSE', '0').replace('CURRENT_DATE', str(date.today()))
  1751 
  1751 
  1752     def test_has_text(self):
  1752     def test_has_text(self):
  1753         for t in self._parse(HAS_TEXT_LG_INDEXER):
  1753         for t in self._parse(HAS_TEXT_LG_INDEXER):
  1754             yield t
  1754             yield t
  1755 
  1755