server/test/unittest_rql2sql.py
changeset 6631 26c303c3f1aa
parent 6493 019ab5eb37ea
child 6781 5062d86d6ffe
equal deleted inserted replaced
6630:f516ee1ef36c 6631:26c303c3f1aa
    36     register_function(stockproc)
    36     register_function(stockproc)
    37 except AssertionError, ex:
    37 except AssertionError, ex:
    38     pass # already registered
    38     pass # already registered
    39 
    39 
    40 
    40 
    41 config = TestServerConfiguration('data')
    41 def setup_module(*args):
    42 config.bootstrap_cubes()
    42     global config, schema
    43 schema = config.load_schema()
    43     config = TestServerConfiguration('data', apphome=CWRQLTC.datadir)
    44 schema['in_state'].inlined = True
    44     config.bootstrap_cubes()
    45 schema['state_of'].inlined = False
    45     schema = config.load_schema()
    46 schema['comments'].inlined = False
    46     schema['in_state'].inlined = True
       
    47     schema['state_of'].inlined = False
       
    48     schema['comments'].inlined = False
    47 
    49 
    48 def teardown_module(*args):
    50 def teardown_module(*args):
    49     global config, schema
    51     global config, schema
    50     del config, schema
    52     del config, schema
    51 
    53 
  1074 FROM is_relation AS rel_is0
  1076 FROM is_relation AS rel_is0
  1075 WHERE rel_is0.eid_to=2'''),
  1077 WHERE rel_is0.eid_to=2'''),
  1076 
  1078 
  1077     ]
  1079     ]
  1078 class CWRQLTC(RQLGeneratorTC):
  1080 class CWRQLTC(RQLGeneratorTC):
  1079     schema = schema
       
  1080     backend = 'sqlite'
  1081     backend = 'sqlite'
       
  1082 
       
  1083     def setUp(self):
       
  1084         self.__class__.schema = schema
       
  1085         super(CWRQLTC, self).setUp()
       
  1086 
  1081     def test_nonregr_sol(self):
  1087     def test_nonregr_sol(self):
  1082         delete = self.rqlhelper.parse(
  1088         delete = self.rqlhelper.parse(
  1083             'DELETE X read_permission READ_PERMISSIONSUBJECT,X add_permission ADD_PERMISSIONSUBJECT,'
  1089             'DELETE X read_permission READ_PERMISSIONSUBJECT,X add_permission ADD_PERMISSIONSUBJECT,'
  1084             'X in_basket IN_BASKETSUBJECT,X delete_permission DELETE_PERMISSIONSUBJECT,'
  1090             'X in_basket IN_BASKETSUBJECT,X delete_permission DELETE_PERMISSIONSUBJECT,'
  1085             'X update_permission UPDATE_PERMISSIONSUBJECT,'
  1091             'X update_permission UPDATE_PERMISSIONSUBJECT,'
  1103 
  1109 
  1104 def strip(text):
  1110 def strip(text):
  1105     return '\n'.join(l.strip() for l in text.strip().splitlines())
  1111     return '\n'.join(l.strip() for l in text.strip().splitlines())
  1106 
  1112 
  1107 class PostgresSQLGeneratorTC(RQLGeneratorTC):
  1113 class PostgresSQLGeneratorTC(RQLGeneratorTC):
  1108     schema = schema
       
  1109     backend = 'postgres'
  1114     backend = 'postgres'
       
  1115 
       
  1116     def setUp(self):
       
  1117         self.__class__.schema = schema
       
  1118         super(PostgresSQLGeneratorTC, self).setUp()
  1110 
  1119 
  1111     def _norm_sql(self, sql):
  1120     def _norm_sql(self, sql):
  1112         return sql.strip()
  1121         return sql.strip()
  1113 
  1122 
  1114     def _check(self, rql, sql, varmap=None, args=None):
  1123     def _check(self, rql, sql, varmap=None, args=None):