# Path: dyndnsc/detector/base.py
# LOG = logging.getLogger(__name__)
# class IPDetector(Subject, DynamicCliMixin):
#     def __init__(self, *args, **kwargs):
#     def can_detect_offline(self):
#     def af(self):
#     def get_old_value(self):
#     def set_old_value(self, value):
#     def get_current_value(self, default=None):
#     def set_current_value(self, value):
#     def has_changed(self):
#     def configuration_key_prefix():
# 
# Path: dyndnsc/common/six.py
# def ipaddress(addr):
# def ipnetwork(addr):


import unittest
    import netifaces
    import netifaces
from dyndnsc.detector.base import AF_INET6
from dyndnsc.common.six import string_types
        from dyndnsc.detector import iface
        from dyndnsc.detector import teredo


class IfaceDetectorTest(unittest.TestCase):
    """Test cases for iface detector."""

    def test_iface_detector(self):
        """Run iface tests."""
        self.assertEqual("iface", iface.IPDetector_Iface.configuration_key)
        # auto-detect an interface:
        interface = give_me_an_interface_ipv4()
        self.assertNotEqual(None, interface)
        detector = iface.IPDetector_Iface(iface=interface)
        self.assertTrue(detector.can_detect_offline())
        self.assertEqual(None, detector.get_current_value())
        self.assertTrue(isinstance(detector.detect(), string_types + (type(None),)))
        # empty interface name must not fail construction
        self.assertIsInstance(iface.IPDetector_Iface(iface=None), iface.IPDetector_Iface)
        # invalid netmask must fail construction
        self.assertRaises(ValueError, iface.IPDetector_Iface, netmask="fubar")
        # unknown address family  must fail construction
        self.assertRaises(ValueError, iface.IPDetector_Iface, family="bla")

    def test_teredo_detector(self):
        """Run teredo tests."""
        self.assertEqual("teredo", teredo.IPDetector_Teredo.configuration_key)
        # auto-detect an interface:
        interface = give_me_an_interface_ipv6()
        if interface is not None:  # we have ip6 support
            detector = teredo.IPDetector_Teredo(iface=interface)
            self.assertTrue(detector.can_detect_offline())

# Path: dyndnsc/detector/base.py
# LOG = logging.getLogger(__name__)
# class IPDetector(Subject, DynamicCliMixin):
#     def __init__(self, *args, **kwargs):
#     def can_detect_offline(self):
#     def af(self):
#     def get_old_value(self):
#     def set_old_value(self, value):
#     def get_current_value(self, default=None):
#     def set_current_value(self, value):
#     def has_changed(self):
#     def configuration_key_prefix():
# 
# Path: dyndnsc/common/six.py
# def ipaddress(addr):
# def ipnetwork(addr):


# Path: dyndnsc/tests/detector/test_iface.py
import unittest
    import netifaces
    import netifaces
from dyndnsc.detector.base import AF_INET6
from dyndnsc.common.six import string_types
        from dyndnsc.detector import iface
        from dyndnsc.detector import teredo



class IfaceDetectorTest(unittest.TestCase):
    """Test cases for iface detector."""

    def test_iface_detector(self):
        """Run iface tests."""
        self.assertEqual("iface", iface.IPDetector_Iface.configuration_key)
        # auto-detect an interface:
        interface = give_me_an_interface_ipv4()
        self.assertNotEqual(None, interface)
        detector = iface.IPDetector_Iface(iface=interface)
        self.assertTrue(detector.can_detect_offline())
        self.assertEqual(None, detector.get_current_value())
        self.assertTrue(isinstance(detector.detect(), string_types + (type(None),)))
        # empty interface name must not fail construction
        self.assertIsInstance(iface.IPDetector_Iface(iface=None), iface.IPDetector_Iface)
        # invalid netmask must fail construction
        self.assertRaises(ValueError, iface.IPDetector_Iface, netmask="fubar")
        # unknown address family  must fail construction
        self.assertRaises(ValueError, iface.IPDetector_Iface, family="bla")

    def test_teredo_detector(self):
        """Run teredo tests."""
        self.assertEqual("teredo", teredo.IPDetector_Teredo.configuration_key)
        # auto-detect an interface:
        interface = give_me_an_interface_ipv6()
        if interface is not None:  # we have ip6 support
            detector = teredo.IPDetector_Teredo(iface=interface)
            self.assertTrue(detector.can_detect_offline())

            self.assertEqual(AF_INET6, detector.af())