"""Basic tests — module loads, all methods exist."""

import unittest

from dnsrobot import DNSRobot, __version__


class TestBasic(unittest.TestCase):
    def test_version_defined(self):
        self.assertIsNotNone(__version__)
        self.assertRegex(__version__, r"^\d+\.\d+\.\d+$")

    def test_constructor(self):
        dr = DNSRobot()
        self.assertIsInstance(dr, DNSRobot)

    def test_constructor_custom(self):
        dr = DNSRobot(
            base_url="https://example.com/api",
            timeout=10,
            user_agent="TestAgent/1.0",
        )
        self.assertIsInstance(dr, DNSRobot)
        self.assertEqual(dr.base_url, "https://example.com/api")
        self.assertEqual(dr.timeout, 10)
        self.assertEqual(dr.user_agent, "TestAgent/1.0")

    def test_all_methods_exist(self):
        dr = DNSRobot()
        methods = [
            "dns_lookup", "whois_lookup", "ssl_check",
            "spf_check", "dkim_check", "dmarc_check",
            "mx_lookup", "ns_lookup", "ip_lookup",
            "http_headers", "port_check",
        ]
        for method in methods:
            self.assertTrue(
                hasattr(dr, method) and callable(getattr(dr, method)),
                f"Missing method: {method}",
            )


if __name__ == "__main__":
    unittest.main()
