# Path: os_vif/internal/ip/windows/impl_netifaces.py
# LOG = logging.getLogger(__name__)
# class Netifaces(ip_command.IpCommand):
#     def exists(self, device):
#     def set(self, device, check_exit_code=None, state=None, mtu=None,
#             address=None, promisc=None, master=None):
#     def add(self, device, dev_type, check_exit_code=None, peer=None, link=None,
#             vlan_id=None):
#     def delete(self, device, check_exit_code=None):
# 
# Path: os_vif/tests/unit/base.py
# class TestCase(testtools.TestCase):


from unittest import mock
from os_vif.internal.ip.windows import impl_netifaces as ip_lib
from os_vif.tests.unit import base
import netifaces
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.





class TestIPDevice(base.TestCase):

    def setUp(self):
        super(TestIPDevice, self).setUp()
        self.device_name = 'test_device'
        self.mock_log = mock.patch.object(ip_lib, "LOG").start()
        self.ip_lib = ip_lib.Netifaces()

    @mock.patch.object(netifaces, 'ifaddresses', return_value=True)
    def test_exists(self, mock_ifaddresses):
        self.assertTrue(self.ip_lib.exists(self.device_name))
        mock_ifaddresses.assert_called_once_with(self.device_name)

    @mock.patch.object(netifaces, 'ifaddresses', side_effect=ValueError())
    def test_exists_not_found(self, mock_ifaddresses):
        self.assertFalse(self.ip_lib.exists(self.device_name))
        mock_ifaddresses.assert_called_once_with(self.device_name)
        self.mock_log.warning.assert_called_once_with(
            "The device does not exist on the system: %s", self.device_name)


# Path: os_vif/internal/ip/windows/impl_netifaces.py
# LOG = logging.getLogger(__name__)
# class Netifaces(ip_command.IpCommand):
#     def exists(self, device):
#     def set(self, device, check_exit_code=None, state=None, mtu=None,
#             address=None, promisc=None, master=None):
#     def add(self, device, dev_type, check_exit_code=None, peer=None, link=None,
#             vlan_id=None):
#     def delete(self, device, check_exit_code=None):
# 
# Path: os_vif/tests/unit/base.py
# class TestCase(testtools.TestCase):


# Path: os_vif/tests/unit/internal/ip/windows/test_impl_netifaces.py
from unittest import mock
from os_vif.internal.ip.windows import impl_netifaces as ip_lib
from os_vif.tests.unit import base
import netifaces

#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.





class TestIPDevice(base.TestCase):

    def setUp(self):
        super(TestIPDevice, self).setUp()
        self.device_name = 'test_device'
        self.mock_log = mock.patch.object(ip_lib, "LOG").start()
        self.ip_lib = ip_lib.Netifaces()

    @mock.patch.object(netifaces, 'ifaddresses', return_value=True)
    def test_exists(self, mock_ifaddresses):
        self.assertTrue(self.ip_lib.exists(self.device_name))
        mock_ifaddresses.assert_called_once_with(self.device_name)

    @mock.patch.object(netifaces, 'ifaddresses', side_effect=ValueError())
    def test_exists_not_found(self, mock_ifaddresses):
        self.assertFalse(self.ip_lib.exists(self.device_name))
        mock_ifaddresses.assert_called_once_with(self.device_name)
        self.mock_log.warning.assert_called_once_with(
            "The device does not exist on the system: %s", self.device_name)


    @mock.patch.object(netifaces, 'ifaddresses', side_effect=OSError())