# Path: os_brick/exception.py
# LOG = logging.getLogger(__name__)
# class BrickException(Exception):
# class NotFound(BrickException):
# class Invalid(BrickException):
# class InvalidParameterValue(Invalid):
# class NoFibreChannelHostsFound(BrickException):
# class NoFibreChannelVolumeDeviceFound(BrickException):
# class VolumeNotDeactivated(BrickException):
# class VolumeDeviceNotFound(BrickException):
# class VolumePathsNotFound(BrickException):
# class VolumePathNotRemoved(BrickException):
# class ProtocolNotSupported(BrickException):
# class TargetPortalNotFound(BrickException):
# class TargetPortalsNotFound(TargetPortalNotFound):
# class FailedISCSITargetPortalLogin(BrickException):
# class BlockDeviceReadOnly(BrickException):
# class VolumeGroupNotFound(BrickException):
# class VolumeGroupCreationFailed(BrickException):
# class CommandExecutionFailed(BrickException):
# class VolumeDriverException(BrickException):
# class InvalidIOHandleObject(BrickException):
# class VolumeEncryptionNotSupported(Invalid):
# class VolumeLocalCacheNotSupported(Invalid):
# class InvalidConnectorProtocol(ValueError):
# class ExceptionChainer(BrickException):
# class ExecutionTimeout(putils.ProcessExecutionError):
#     def __init__(self, message=None, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __repr__(self):
#     def __nonzero__(self) -> bool:
#     def add_exception(self, exc_type, exc_val, exc_tb) -> None:
#     def context(self,
#                 catch_exception: bool,
#                 msg: str = '',
#                 *msg_args: Iterable):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
# 
# Path: os_brick/initiator/windows/iscsi.py
# LOG = logging.getLogger(__name__)
# class WindowsISCSIConnector(win_conn_base.BaseWindowsConnector,
#                             base_iscsi.BaseISCSIConnector):
#     def __init__(self, *args, **kwargs):
#     def validate_initiators(self):
#     def get_initiator(self):
#     def get_connector_properties(*args, **kwargs):
#     def _get_all_paths(self, connection_properties):
#     def connect_volume(self, connection_properties):
#     def disconnect_volume(self, connection_properties, device_info=None,
#                           force=False, ignore_errors=False):
#     def get_volume_paths(self, connection_properties):
# 
# Path: os_brick/tests/windows/test_base.py
# class WindowsConnectorTestBase(base.TestCase):
#     def setUp(self):


from unittest import mock
from os_win import exceptions as os_win_exc
from os_brick import exception
from os_brick.initiator.windows import iscsi
from os_brick.tests.windows import test_base
import ddt
        self._iscsi_utils.login_storage_target.assert_has_calls(
            [mock.call(target_lun=mock.sentinel.target_lun,
                       target_iqn=mock.sentinel.target_iqn,
                       target_portal=mock.sentinel.target_portal,
                       auth_username=mock.sentinel.auth_username,
                       auth_password=mock.sentinel.auth_password,
                       mpio_enabled=use_multipath,
                       initiator_name=mock.sentinel.initiator_name,
                       ensure_lun_available=False)] *
            expected_login_attempts)
        self._iscsi_utils.get_device_number_and_path.assert_called_once_with(
            mock.sentinel.target_iqn, mock.sentinel.target_lun,
            retry_attempts=self._connector.device_scan_attempts,
            retry_interval=self._connector.device_scan_interval,
            rescan_disks=True,
            ensure_mpio_claimed=use_multipath)
        mock_get_scsi_wwn.assert_called_once_with(mock.sentinel.device_number)

    @mock.patch.object(iscsi.WindowsISCSIConnector, '_get_all_paths')
    def test_connect_volume_exc(self, mock_get_all_paths):
        fake_paths = [(mock.sentinel.initiator_name,
                       mock.sentinel.target_portal,
                       mock.sentinel.target_iqn,
                       mock.sentinel.target_lun)] * 3

        mock_get_all_paths.return_value = fake_paths
        self._iscsi_utils.login_storage_target.side_effect = (
            os_win_exc.OSWinException)
        self._connector.use_multipath = True


# Path: os_brick/exception.py
# LOG = logging.getLogger(__name__)
# class BrickException(Exception):
# class NotFound(BrickException):
# class Invalid(BrickException):
# class InvalidParameterValue(Invalid):
# class NoFibreChannelHostsFound(BrickException):
# class NoFibreChannelVolumeDeviceFound(BrickException):
# class VolumeNotDeactivated(BrickException):
# class VolumeDeviceNotFound(BrickException):
# class VolumePathsNotFound(BrickException):
# class VolumePathNotRemoved(BrickException):
# class ProtocolNotSupported(BrickException):
# class TargetPortalNotFound(BrickException):
# class TargetPortalsNotFound(TargetPortalNotFound):
# class FailedISCSITargetPortalLogin(BrickException):
# class BlockDeviceReadOnly(BrickException):
# class VolumeGroupNotFound(BrickException):
# class VolumeGroupCreationFailed(BrickException):
# class CommandExecutionFailed(BrickException):
# class VolumeDriverException(BrickException):
# class InvalidIOHandleObject(BrickException):
# class VolumeEncryptionNotSupported(Invalid):
# class VolumeLocalCacheNotSupported(Invalid):
# class InvalidConnectorProtocol(ValueError):
# class ExceptionChainer(BrickException):
# class ExecutionTimeout(putils.ProcessExecutionError):
#     def __init__(self, message=None, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __repr__(self):
#     def __nonzero__(self) -> bool:
#     def add_exception(self, exc_type, exc_val, exc_tb) -> None:
#     def context(self,
#                 catch_exception: bool,
#                 msg: str = '',
#                 *msg_args: Iterable):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
# 
# Path: os_brick/initiator/windows/iscsi.py
# LOG = logging.getLogger(__name__)
# class WindowsISCSIConnector(win_conn_base.BaseWindowsConnector,
#                             base_iscsi.BaseISCSIConnector):
#     def __init__(self, *args, **kwargs):
#     def validate_initiators(self):
#     def get_initiator(self):
#     def get_connector_properties(*args, **kwargs):
#     def _get_all_paths(self, connection_properties):
#     def connect_volume(self, connection_properties):
#     def disconnect_volume(self, connection_properties, device_info=None,
#                           force=False, ignore_errors=False):
#     def get_volume_paths(self, connection_properties):
# 
# Path: os_brick/tests/windows/test_base.py
# class WindowsConnectorTestBase(base.TestCase):
#     def setUp(self):


# Path: os_brick/tests/windows/test_iscsi.py
from unittest import mock
from os_win import exceptions as os_win_exc
from os_brick import exception
from os_brick.initiator.windows import iscsi
from os_brick.tests.windows import test_base
import ddt

        self._iscsi_utils.login_storage_target.assert_has_calls(
            [mock.call(target_lun=mock.sentinel.target_lun,
                       target_iqn=mock.sentinel.target_iqn,
                       target_portal=mock.sentinel.target_portal,
                       auth_username=mock.sentinel.auth_username,
                       auth_password=mock.sentinel.auth_password,
                       mpio_enabled=use_multipath,
                       initiator_name=mock.sentinel.initiator_name,
                       ensure_lun_available=False)] *
            expected_login_attempts)
        self._iscsi_utils.get_device_number_and_path.assert_called_once_with(
            mock.sentinel.target_iqn, mock.sentinel.target_lun,
            retry_attempts=self._connector.device_scan_attempts,
            retry_interval=self._connector.device_scan_interval,
            rescan_disks=True,
            ensure_mpio_claimed=use_multipath)
        mock_get_scsi_wwn.assert_called_once_with(mock.sentinel.device_number)

    @mock.patch.object(iscsi.WindowsISCSIConnector, '_get_all_paths')
    def test_connect_volume_exc(self, mock_get_all_paths):
        fake_paths = [(mock.sentinel.initiator_name,
                       mock.sentinel.target_portal,
                       mock.sentinel.target_iqn,
                       mock.sentinel.target_lun)] * 3

        mock_get_all_paths.return_value = fake_paths
        self._iscsi_utils.login_storage_target.side_effect = (
            os_win_exc.OSWinException)
        self._connector.use_multipath = True


        self.assertRaises(exception.BrickException,