diff options
| author | Claude Paroz <claude@2xlibre.net> | 2013-06-29 18:44:41 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-06-29 18:48:05 +0200 |
| commit | 59be2c6875eaf744798d14c9dc8498552c8d48d5 (patch) | |
| tree | 0ade346f5460868542eea401f368592f8cef07ed /tests/backends | |
| parent | a9b5a1e506a9e8492407399b8bec1c2a8420be60 (diff) | |
[1.6.x] Fixed #18592 -- Prevented crash when accessing MySQL _last_executed
Thanks reames at asymmetricventures.com for the report.
Backport of 59b0c48ce from master.
Diffstat (limited to 'tests/backends')
| -rw-r--r-- | tests/backends/tests.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/backends/tests.py b/tests/backends/tests.py index c1a26df7fc..488f8d518b 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -164,6 +164,17 @@ class DateQuotingTest(TestCase): @override_settings(DEBUG=True) class LastExecutedQueryTest(TestCase): + def test_last_executed_query(self): + """ + last_executed_query should not raise an exception even if no previous + query has been run. + """ + cursor = connection.cursor() + try: + connection.ops.last_executed_query(cursor, '', ()) + except Exception: + self.fail("'last_executed_query' should not raise an exception.") + def test_debug_sql(self): list(models.Reporter.objects.filter(first_name="test")) sql = connection.queries[-1]['sql'].lower() |
