Ejemplo n.º 1
0
 def test_skip_locked_no_wait(self):
     with mock.MagicMock() as _connection:
         _connection.mysql_version = (8, 0, 1)
         _connection.mysql_is_mariadb = False
         database_features = DatabaseFeatures(_connection)
         self.assertTrue(database_features.has_select_for_update_skip_locked)
         self.assertTrue(database_features.has_select_for_update_nowait)
     with mock.MagicMock() as _connection:
         _connection.mysql_version = (8, 0, 0)
         _connection.mysql_is_mariadb = False
         database_features = DatabaseFeatures(_connection)
         self.assertFalse(database_features.has_select_for_update_skip_locked)
         self.assertFalse(database_features.has_select_for_update_nowait)
Ejemplo n.º 2
0
    def test_skip_locked_no_wait(self):
        """
        Test if both features are enabled for MYSQL V8.0.1+ and disabled for the older releases
        """
        with mock.MagicMock() as _connection:
            _connection.mysql_version = (8, 0, 1)
            database_features = DatabaseFeatures(_connection)
            self.assertTrue(
                database_features.has_select_for_update_skip_locked)
            self.assertTrue(database_features.has_select_for_update_nowait)

        with mock.MagicMock() as _connection:
            _connection.mysql_version = (5, 7, 0)
            database_features = DatabaseFeatures(_connection)
            self.assertFalse(
                database_features.has_select_for_update_skip_locked)
            self.assertFalse(database_features.has_select_for_update_nowait)
Ejemplo n.º 3
0
 def test_allows_auto_pk_0(self):
     with mock.MagicMock() as _connection:
         _connection.sql_mode = {'NO_AUTO_VALUE_ON_ZERO'}
         database_features = DatabaseFeatures(_connection)
         self.assertIs(database_features.allows_auto_pk_0, True)