Extract shared adapter validation helpers

This commit is contained in:
Lyncoln
2026-09-20 18:47:21 -04:00
parent d4ceb7e1df
commit 832928159d
6 changed files with 232 additions and 28 deletions
+24
View File
@@ -6,6 +6,7 @@ from dns_sync.adapters import (
CERTIFICATES,
PROXY_HOSTS,
Capability,
Endpoint,
CapabilityOperation,
NormalizedObject,
ObjectReference,
@@ -94,6 +95,29 @@ class NpmAdapterTests(unittest.TestCase):
self.assertIs(adapters[0].client, first_client)
self.assertIs(adapters[1].client, second_client)
def test_adapter_rejects_endpoint_for_other_plugin(self):
config = self.config()
endpoint = Endpoint(
"verizon",
"192.168.1.1:443",
)
with patch(
"dns_sync.plugins.adapters.npm.NpmClient"
) as client_class:
with self.assertRaisesRegex(
RuntimeError,
"cannot use endpoint",
):
load_adapter(
"npm",
config,
endpoint,
)
client_class.assert_not_called()
def test_capabilities_cover_discovery_apply_and_verify(self):
adapter = self.adapter(Mock())