# 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():


import unittest
    import socket
        import dyndnsc.detector.builtin
        import dyndnsc.detector.manager
        import dyndnsc.detector.dns as ns
        import dyndnsc.detector.base
        import dyndnsc.detector.dns as ns
        import dyndnsc.detector.command
        import dyndnsc.detector.rand
        import dyndnsc.detector.rand
from dyndnsc.detector.base import AF_INET, AF_INET6, AF_UNSPEC
        from dyndnsc.detector import socket_ip
        from dyndnsc.detector import webcheck
        from dyndnsc.detector import webcheck
        from dyndnsc.detector import webcheck
        from dyndnsc.detector import webcheck
        from dyndnsc.detector import null
        ip2 = "127.0.0.2"
        detector = dyndnsc.detector.base.IPDetector()

        self.assertEqual(None, detector.get_current_value())
        self.assertEqual(None, detector.get_old_value())
        self.assertFalse(detector.has_changed())

        # set to ip1
        self.assertEqual(ip1, detector.set_current_value(ip1))
        self.assertTrue(detector.has_changed())
        self.assertEqual(ip1, detector.get_current_value())
        self.assertEqual(None, detector.get_old_value())

        # set to ip2
        self.assertEqual(ip2, detector.set_current_value(ip2))
        self.assertEqual(ip2, detector.get_current_value())
        self.assertEqual(ip1, detector.get_old_value())
        self.assertTrue(detector.has_changed())

        # set again to ip2
        self.assertEqual(ip2, detector.set_current_value(ip2))
        self.assertFalse(detector.has_changed())
        self.assertEqual(ip2, detector.get_current_value())
        self.assertEqual(ip2, detector.get_old_value())

    def test_dns_detector(self):
        """Run tests for IPDetector_DNS."""
        self.assertEqual("dns", ns.IPDetector_DNS.configuration_key)
        detector = ns.IPDetector_DNS(hostname="localhost")
        self.assertFalse(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/tests/detector/test_all.py
import unittest
    import socket
        import dyndnsc.detector.builtin
        import dyndnsc.detector.manager
        import dyndnsc.detector.dns as ns
        import dyndnsc.detector.base
        import dyndnsc.detector.dns as ns
        import dyndnsc.detector.command
        import dyndnsc.detector.rand
        import dyndnsc.detector.rand
from dyndnsc.detector.base import AF_INET, AF_INET6, AF_UNSPEC
        from dyndnsc.detector import socket_ip
        from dyndnsc.detector import webcheck
        from dyndnsc.detector import webcheck
        from dyndnsc.detector import webcheck
        from dyndnsc.detector import webcheck
        from dyndnsc.detector import null

        ip2 = "127.0.0.2"
        detector = dyndnsc.detector.base.IPDetector()

        self.assertEqual(None, detector.get_current_value())
        self.assertEqual(None, detector.get_old_value())
        self.assertFalse(detector.has_changed())

        # set to ip1
        self.assertEqual(ip1, detector.set_current_value(ip1))
        self.assertTrue(detector.has_changed())
        self.assertEqual(ip1, detector.get_current_value())
        self.assertEqual(None, detector.get_old_value())

        # set to ip2
        self.assertEqual(ip2, detector.set_current_value(ip2))
        self.assertEqual(ip2, detector.get_current_value())
        self.assertEqual(ip1, detector.get_old_value())
        self.assertTrue(detector.has_changed())

        # set again to ip2
        self.assertEqual(ip2, detector.set_current_value(ip2))
        self.assertFalse(detector.has_changed())
        self.assertEqual(ip2, detector.get_current_value())
        self.assertEqual(ip2, detector.get_old_value())

    def test_dns_detector(self):
        """Run tests for IPDetector_DNS."""
        self.assertEqual("dns", ns.IPDetector_DNS.configuration_key)
        detector = ns.IPDetector_DNS(hostname="localhost")
        self.assertFalse(detector.can_detect_offline())

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