def test_exec_string_commodity(self): """Test if exec_string function prints the right thing When the query wants to find commodity """ string = an.exec_string(['uox', 'mox'], 'commodity', 'time, quantity') answer = ('SELECT time, quantity ' 'FROM resources INNER JOIN transactions ' 'ON transactions.resourceid = resources.resourceid ' 'WHERE (commodity = "uox" OR commodity = "mox")') self.assertEqual(string, answer)
def test_exec_string_receiverid(self): """Test if exec_string function prints the right thing When the query wants to find receiverid """ string = an.exec_string([12, 35], 'receiverid', 'time, quantity') answer = ('SELECT time, quantity ' 'FROM resources INNER JOIN transactions ' 'ON transactions.resourceid = resources.resourceid ' 'WHERE (receiverid = 12 OR receiverid = 35)') self.assertEqual(string, answer)