From a2022dae7ff70b00ab61e2ca2da0980a7747824b Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Wed, 13 Jun 2012 13:28:09 +0200 Subject: [PATCH] Removed escaping test of query content As the content of last_executed_query() is not under Django's control for most backends, it is useless to test too specific aspects of it. --- tests/regressiontests/backends/tests.py | 26 +++++-------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/tests/regressiontests/backends/tests.py b/tests/regressiontests/backends/tests.py index cf4242d62c..c6d28ab135 100644 --- a/tests/regressiontests/backends/tests.py +++ b/tests/regressiontests/backends/tests.py @@ -127,28 +127,12 @@ class DateQuotingTest(TestCase): class LastExecutedQueryTest(TestCase): - # There are no escaping tests for the sqlite backend because it does not - # implement paramater escaping. See #14091. - - @unittest.skipUnless(connection.vendor in ('oracle', 'postgresql'), - "These backends use the standard parameter escaping rules") @override_settings(DEBUG=True) - def test_parameter_escaping(self): - # check that both numbers and string are properly quoted - list(models.Tag.objects.filter(name="special:\\\"':", object_id=12)) - sql = connection.queries[-1]['sql'] - self.assertTrue("= 'special:\\\"'':' " in sql) - self.assertTrue("= 12 " in sql) - - @unittest.skipUnless(connection.vendor == 'mysql', - "MySQL uses backslashes to escape parameters.") - @override_settings(DEBUG=True) - def test_parameter_escaping(self): - list(models.Tag.objects.filter(name="special:\\\"':", object_id=12)) - sql = connection.queries[-1]['sql'] - # only this line is different from the test above - self.assertTrue("= 'special:\\\\\\\"\\':' " in sql) - self.assertTrue("= 12 " in sql) + def test_debug_sql(self): + list(models.Tag.objects.filter(name="test")) + sql = connection.queries[-1]['sql'].lower() + self.assertTrue(sql.startswith("select")) + self.assertIn(models.Tag._meta.db_table, sql) def test_query_encoding(self): """