# Path: os_win/exceptions.py
#     class WindowsError(Exception):
#     class x_wmi(Exception):
#     class x_wmi_timed_out(x_wmi):
# class OSWinException(Exception):
# class NotFound(OSWinException):
# class PciDeviceNotFound(NotFound):
# class HyperVException(OSWinException):
# class VHDResizeException(HyperVException):
# class HyperVAuthorizationException(HyperVException):
# class HyperVVMNotFoundException(NotFound, HyperVException):
# class HyperVPortNotFoundException(NotFound, HyperVException):
# class HyperVvNicNotFound(NotFound, HyperVException):
# class HyperVvSwitchNotFound(NotFound, HyperVException):
# class Invalid(OSWinException):
# class UnsupportedOperation(Invalid):
# class InvalidParameterValue(Invalid):
# class InvalidVMVersion(Invalid):
# class SMBException(OSWinException):
# class Win32Exception(OSWinException):
# class VHDException(OSWinException):
# class VHDWin32APIException(VHDException, Win32Exception):
# class FCException(OSWinException):
# class FCWin32Exception(FCException, Win32Exception):
# class WMIException(OSWinException):
# class WqlException(OSWinException):
# class ISCSITargetException(OSWinException):
# class ISCSITargetWMIException(ISCSITargetException, WMIException):
# class ISCSIInitiatorAPIException(Win32Exception):
# class ISCSILunNotAvailable(ISCSITargetException):
# class Win32IOException(Win32Exception):
# class DiskNotFound(NotFound):
# class HyperVRemoteFXException(HyperVException):
# class HyperVClusterException(HyperVException):
# class DNSException(OSWinException):
# class Timeout(OSWinException):
# class DNSZoneNotFound(NotFound, DNSException):
# class DNSZoneAlreadyExists(DNSException):
# class WMIJobFailed(HyperVException):
# class JobTerminateFailed(HyperVException):
# class ClusterException(OSWinException):
# class ClusterObjectNotFound(NotFound, ClusterException):
# class ClusterWin32Exception(ClusterException, Win32Exception):
# class ClusterGroupMigrationFailed(ClusterException):
# class ClusterGroupMigrationTimeOut(ClusterGroupMigrationFailed):
# class ClusterPropertyRetrieveFailed(ClusterException):
# class ClusterPropertyListEntryNotFound(ClusterPropertyRetrieveFailed):
# class ClusterPropertyListParsingError(ClusterPropertyRetrieveFailed):
# class SCSIPageParsingError(Invalid):
# class SCSIIdDescriptorParsingError(Invalid):
# class ResourceUpdateError(OSWinException):
# class DiskUpdateError(OSWinException):
#         def __init__(self, winerror=None):
#         def __init__(self, info='', com_error=None):
#     def __init__(self, message=None, **kwargs):
#     def __init__(self, message=None, wmi_exc=None):
#     def __init__(self, message=None, **kwargs):
# 
# Path: os_win/tests/unit/test_base.py
# class TestingException(Exception):
# class FakeWMIExc(exceptions.x_wmi):
# class BaseTestCase(base.BaseTestCase):
# class OsWinBaseTestCase(BaseTestCase):
#     def __init__(self, hresult=None):
#     def setUp(self):
#     def _patch_autospec_classes(self):
#     def setUp(self):
# 
# Path: os_win/utils/storage/smbutils.py
# LOG = logging.getLogger(__name__)
# class SMBUtils(baseutils.BaseUtils):
#     def __init__(self):
#     def check_smb_mapping(self, share_path, remove_unavailable_mapping=False):
#     def mount_smb_share(self, share_path, username=None, password=None):
#     def unmount_smb_share(self, share_path, force=False):
#     def get_smb_share_path(self, share_name):
#     def is_local_share(self, share_path):


from unittest import mock
from os_win import exceptions
from os_win.tests.unit import test_base
from os_win.utils.storage import smbutils
import ddt

        self.assertRaises(exceptions.SMBException,
                          self._smbutils.mount_smb_share,
                          mock.sentinel.share_path)

    def _test_unmount_smb_share(self, force=False):
        fake_mapping = mock.Mock()
        fake_mapping_attr_err = mock.Mock()
        fake_mapping_attr_err.side_effect = AttributeError
        smb_mapping_class = self._smb_conn.Msft_SmbMapping
        smb_mapping_class.return_value = [fake_mapping, fake_mapping_attr_err]

        self._smbutils.unmount_smb_share(mock.sentinel.share_path,
                                         force)

        smb_mapping_class.assert_called_once_with(
            RemotePath=mock.sentinel.share_path)
        fake_mapping.Remove.assert_called_once_with(Force=force)

    def test_soft_unmount_smb_share(self):
        self._test_unmount_smb_share()

    def test_force_unmount_smb_share(self):
        self._test_unmount_smb_share(force=True)

    def test_unmount_smb_share_wmi_exception(self):
        fake_mapping = mock.Mock()
        fake_mapping.Remove.side_effect = exceptions.x_wmi
        self._smb_conn.Msft_SmbMapping.return_value = [fake_mapping]


# Path: os_win/exceptions.py
#     class WindowsError(Exception):
#     class x_wmi(Exception):
#     class x_wmi_timed_out(x_wmi):
# class OSWinException(Exception):
# class NotFound(OSWinException):
# class PciDeviceNotFound(NotFound):
# class HyperVException(OSWinException):
# class VHDResizeException(HyperVException):
# class HyperVAuthorizationException(HyperVException):
# class HyperVVMNotFoundException(NotFound, HyperVException):
# class HyperVPortNotFoundException(NotFound, HyperVException):
# class HyperVvNicNotFound(NotFound, HyperVException):
# class HyperVvSwitchNotFound(NotFound, HyperVException):
# class Invalid(OSWinException):
# class UnsupportedOperation(Invalid):
# class InvalidParameterValue(Invalid):
# class InvalidVMVersion(Invalid):
# class SMBException(OSWinException):
# class Win32Exception(OSWinException):
# class VHDException(OSWinException):
# class VHDWin32APIException(VHDException, Win32Exception):
# class FCException(OSWinException):
# class FCWin32Exception(FCException, Win32Exception):
# class WMIException(OSWinException):
# class WqlException(OSWinException):
# class ISCSITargetException(OSWinException):
# class ISCSITargetWMIException(ISCSITargetException, WMIException):
# class ISCSIInitiatorAPIException(Win32Exception):
# class ISCSILunNotAvailable(ISCSITargetException):
# class Win32IOException(Win32Exception):
# class DiskNotFound(NotFound):
# class HyperVRemoteFXException(HyperVException):
# class HyperVClusterException(HyperVException):
# class DNSException(OSWinException):
# class Timeout(OSWinException):
# class DNSZoneNotFound(NotFound, DNSException):
# class DNSZoneAlreadyExists(DNSException):
# class WMIJobFailed(HyperVException):
# class JobTerminateFailed(HyperVException):
# class ClusterException(OSWinException):
# class ClusterObjectNotFound(NotFound, ClusterException):
# class ClusterWin32Exception(ClusterException, Win32Exception):
# class ClusterGroupMigrationFailed(ClusterException):
# class ClusterGroupMigrationTimeOut(ClusterGroupMigrationFailed):
# class ClusterPropertyRetrieveFailed(ClusterException):
# class ClusterPropertyListEntryNotFound(ClusterPropertyRetrieveFailed):
# class ClusterPropertyListParsingError(ClusterPropertyRetrieveFailed):
# class SCSIPageParsingError(Invalid):
# class SCSIIdDescriptorParsingError(Invalid):
# class ResourceUpdateError(OSWinException):
# class DiskUpdateError(OSWinException):
#         def __init__(self, winerror=None):
#         def __init__(self, info='', com_error=None):
#     def __init__(self, message=None, **kwargs):
#     def __init__(self, message=None, wmi_exc=None):
#     def __init__(self, message=None, **kwargs):
# 
# Path: os_win/tests/unit/test_base.py
# class TestingException(Exception):
# class FakeWMIExc(exceptions.x_wmi):
# class BaseTestCase(base.BaseTestCase):
# class OsWinBaseTestCase(BaseTestCase):
#     def __init__(self, hresult=None):
#     def setUp(self):
#     def _patch_autospec_classes(self):
#     def setUp(self):
# 
# Path: os_win/utils/storage/smbutils.py
# LOG = logging.getLogger(__name__)
# class SMBUtils(baseutils.BaseUtils):
#     def __init__(self):
#     def check_smb_mapping(self, share_path, remove_unavailable_mapping=False):
#     def mount_smb_share(self, share_path, username=None, password=None):
#     def unmount_smb_share(self, share_path, force=False):
#     def get_smb_share_path(self, share_name):
#     def is_local_share(self, share_path):


# Path: os_win/tests/unit/utils/storage/test_smbutils.py
from unittest import mock
from os_win import exceptions
from os_win.tests.unit import test_base
from os_win.utils.storage import smbutils
import ddt


        self.assertRaises(exceptions.SMBException,
                          self._smbutils.mount_smb_share,
                          mock.sentinel.share_path)

    def _test_unmount_smb_share(self, force=False):
        fake_mapping = mock.Mock()
        fake_mapping_attr_err = mock.Mock()
        fake_mapping_attr_err.side_effect = AttributeError
        smb_mapping_class = self._smb_conn.Msft_SmbMapping
        smb_mapping_class.return_value = [fake_mapping, fake_mapping_attr_err]

        self._smbutils.unmount_smb_share(mock.sentinel.share_path,
                                         force)

        smb_mapping_class.assert_called_once_with(
            RemotePath=mock.sentinel.share_path)
        fake_mapping.Remove.assert_called_once_with(Force=force)

    def test_soft_unmount_smb_share(self):
        self._test_unmount_smb_share()

    def test_force_unmount_smb_share(self):
        self._test_unmount_smb_share(force=True)

    def test_unmount_smb_share_wmi_exception(self):
        fake_mapping = mock.Mock()
        fake_mapping.Remove.side_effect = exceptions.x_wmi
        self._smb_conn.Msft_SmbMapping.return_value = [fake_mapping]


        self.assertRaises(exceptions.SMBException,