def test_single_query3(self):
     """test query with multiple tables"""
     query = "find dataset.name, algo.name, primds.name"
     mquery, keylist = query_parser(self.app.mapper, query)
     query = self.app.build_query(query)
     print query
     query = "find dataset.name, algo.name, primds.name where file.name = 123 and \
         (dataset.name = 456 or dataset.name = 789)"
     mquery, keylist = query_parser(self.app.mapper, query)
     query = self.app.build_query(query)
     print query
 def test_single_query(self):
     """
     test single query without constaints
     """
     query = "find dataset.createdate, dataset.name"
     mquery, keylist = query_parser(self.app.mapper, query)
     query = self.app.build_query(query)
     print query
 def test_single_query2(self):
     """
     test single query with constraints
     """
     query = "find dataset.name where file.name = 123 and \
         (dataset.name = 456 or dataset.name = 789)"
     mquery, keylist = query_parser(self.app.mapper, query)
     query = self.app.build_query(query)
     print query
 def test_query_parser(self):
     """
     test clause generation
     """
     query = "find dataset.createdate, dataset.name where file.name = 123"
     mquery, keylist = query_parser(self.app.mapper, query)
     mquery2 = {'keywords':[['ProcessedDataset.CreateDate'], ['Files.Path']],
                 'constraints': [{'value': '123', 'keyword':
                 ['Files.Name', 'file.name'], 'sign': '='}]}
     keylist2 = {'mkeywords': [['ProcessedDataset.CreateDate'],['Files.Path']],
                     'constraints':['file.name'],
                 'keywords':['dataset.createdate', 'dataset.name']}
     self.assertEqual(mquery['keywords'], mquery2['keywords'])
     self.assertEqual(mquery['constraints'],mquery2['constraints'])
     self.assertEqual(keylist['keywords'], keylist2['keywords'])
     self.assertEqual(keylist['constraints'], keylist2['constraints'])