Extract shared adapter validation helpers
This commit is contained in:
@@ -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())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user