diff --git a/tests.py b/tests.py index 4ccae9d..5b3b0ec 100644 --- a/tests.py +++ b/tests.py @@ -580,6 +580,26 @@ def test_getconn_manage_with_exception(self): pass self.assertEqual(len(self.db.conns.busy), 0, msg="Some connections were not recycled") + # Bad formed python string + @gen_test + def test_execute(self): + """Testing execute""" + try: + sql = yield self.conn.execute("SELECT COUNT(*) FROM unittest_large_query WHERE name LIKE %s;", ('%2',)) + except psycopg2.Error as error: + pass + try: + search = "WHERE name LIKE '%%s'" + sql = yield self.conn.execute("SELECT COUNT(*) FROM unittest_large_query %s;" % search) + except psycopg2.Error as error: + pass + try: + search = "WHERE name LIKE '%%searchable' LIMIT %s" % 10 + sql = yield self.conn.execute("SELECT COUNT(*) FROM unittest_large_query %s;" % search) + except psycopg2.Error as error: + pass + + class MomokoPoolDataTestProxy(ProxyMixIn, MomokoPoolDataTest): pass