summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2016-09-29 21:05:35 +0200
committerTim Graham <timograham@gmail.com>2016-10-01 10:01:44 -0400
commit6e4e0f4ce48b80495e89abbee030cf49809a9c54 (patch)
tree1bc4d4bd8afdd75041551605ada544a783586f9c /tests
parentfa2f55cfd554c6f99653ffe0d40fd7ca74cb680e (diff)
Fixed #26541 -- Allowed MySQL transaction detection to work without table creation.
Diffstat (limited to 'tests')
-rw-r--r--tests/backends/test_features.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/backends/test_features.py b/tests/backends/test_features.py
index 831a0002a3..e7cb3dbfe8 100644
--- a/tests/backends/test_features.py
+++ b/tests/backends/test_features.py
@@ -1,8 +1,25 @@
+from unittest import skipUnless
+
from django.db import connection
-from django.test import TestCase
+from django.test import TestCase, mock
class TestDatabaseFeatures(TestCase):
def test_nonexistent_feature(self):
self.assertFalse(hasattr(connection.features, 'nonexistent'))
+
+
+@skipUnless(connection.vendor == 'mysql', 'MySQL backend tests')
+class TestMySQLFeatures(TestCase):
+
+ def test_mysql_supports_transactions(self):
+ """
+ All storage engines except MyISAM support transactions.
+ """
+ with mock.patch('django.db.connection.features._mysql_storage_engine', 'InnoDB'):
+ self.assertTrue(connection.features.supports_transactions)
+ del connection.features.supports_transactions
+ with mock.patch('django.db.connection.features._mysql_storage_engine', 'MyISAM'):
+ self.assertFalse(connection.features.supports_transactions)
+ del connection.features.supports_transactions