def test_executeResultsQuery(self): self.helper.setup_clean_db() my_sql_mixin = MySQLMixin() my_sql_mixin.executeUpdateQuery(""" insert into projects (projectname, description, currency) values ('test', 'a simple test', 'GBP')""") expected = [(2, u'test', None, None, u'a simple test', u'GBP')] query = 'select * from projects' self.assertEqual(expected, my_sql_mixin.executeResultsQuery(query))
def test_executeUpdateQueryWithParams(self): self.helper.setup_clean_db() my_sql_mixin = MySQLMixin() p = ['test3', '2012-06-04', 'description', 'LIR'] my_sql_mixin.executeUpdateQuery(""" insert into projects (projectname, startdate, enddate, description, currency) values (%s, %s, '2013-07-03', %s, %s)""", p) expected = [(2, u'test3', datetime.date(2012, 6, 4), datetime.date(2013, 7, 3), u'description', u'LIR')] query = 'select * from projects' self.assertEqual(expected, my_sql_mixin.executeResultsQuery(query))