summaryrefslogtreecommitdiff
path: root/tests/backends/mysql/test_features.py
blob: 65c897823b5b60f1c437538aa4b8a4fb1f1db5f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from unittest import mock, skipUnless

from django.db import connection
from django.test import TestCase


@skipUnless(connection.vendor == 'mysql', 'MySQL tests')
class TestFeatures(TestCase):

    def test_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