@mock.patch('cloudbaseinit.osutils.windows.WindowsUtils'
                '.execute_process')
    @mock.patch('cloudbaseinit.osutils.windows.WindowsUtils'
                '._get_system_dir')
    @mock.patch("cloudbaseinit.utils.windows.network."
                "get_adapter_addresses")
    @mock.patch('cloudbaseinit.osutils.windows.WindowsUtils'
                '.check_os_version')
    def _test_set_network_adapter_mtu(self,
                                      mock_check_os_version,
                                      mock_get_adapter_addresses,
                                      mock_get_system_dir,
                                      mock_execute_process,
                                      fail=False, os_version_ret=True,
                                      mac_address_match=True,
                                      execute_process_val=0):
        mac_address = "fake mac"
        mtu = "fake mtu"
        base_dir = "fake path"
        mock_check_os_version.return_value = os_version_ret
        mock_get_adapter_addresses.return_value = [mock.MagicMock()
                                                   for _ in range(3)]
        if mac_address_match:
            # Same as `iface_index` under the "interface_index" key.
            mock_get_adapter_addresses.return_value[1].\
                __getitem__.return_value = mac_address
        mock_get_system_dir.return_value = base_dir
        mock_execute_process.return_value = [None, None, execute_process_val]

        if fail:
            with self.assertRaises(exception.CloudbaseInitException):
                self._winutils.set_network_adapter_mtu(mac_address, mtu)
            return

        with self.snatcher:
            self._winutils.set_network_adapter_mtu(mac_address, mtu)
        expected_log = ['Setting MTU for interface "%(mac_address)s" with '
                        'value "%(mtu)s"' %
                        {'mac_address': mac_address, 'mtu': mtu}]
        args = [os.path.join(base_dir, "netsh.exe"),
                "interface", "ipv4", "set", "subinterface",
                mac_address, mtu % "mtu=%s", "store=persistent"]
        self.assertEqual(expected_log, self.snatcher.output)
        mock_check_os_version.assert_called_once_with(6, 0)
        mock_get_adapter_addresses.assert_called_once_with()
        mock_get_system_dir.assert_called_once_with()
        mock_execute_process.assert_called_once_with(args, shell=False)
dataset/ETHPy150Open openstack/cloudbase-init/cloudbaseinit/tests/osutils/test_windows.py/TestWindowsUtils._test_set_network_adapter_mtu/swapped operands of `%`