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.
This commit is contained in:
Claude Paroz 2012-06-13 13:28:09 +02:00
parent 86c20e39eb
commit a2022dae7f
1 changed files with 5 additions and 21 deletions

View File

@ -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):
"""