Prepare NPM references and mutation API
This commit is contained in:
@@ -7,6 +7,7 @@ from dns_sync.adapters import (
|
||||
PROXY_HOSTS,
|
||||
Capability,
|
||||
CapabilityOperation,
|
||||
ObjectReference,
|
||||
)
|
||||
from dns_sync.config import AppConfig
|
||||
from dns_sync.registry import load_adapter
|
||||
@@ -110,6 +111,38 @@ class NpmAdapterTests(unittest.TestCase):
|
||||
discovered[0].payload,
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
discovered[0].references,
|
||||
(
|
||||
ObjectReference(
|
||||
relation="certificate",
|
||||
object_type=CERTIFICATES,
|
||||
local_key="67",
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
def test_proxy_host_without_certificate_has_no_reference(self):
|
||||
client = Mock()
|
||||
client.proxy_hosts.return_value = [
|
||||
{
|
||||
"id": 13,
|
||||
"domain_names": ["plain.example.com"],
|
||||
"forward_scheme": "http",
|
||||
"forward_host": "192.168.1.20",
|
||||
"forward_port": 8080,
|
||||
"certificate_id": 0,
|
||||
"enabled": 1,
|
||||
}
|
||||
]
|
||||
adapter = self.adapter(client)
|
||||
|
||||
discovered = adapter.discover(PROXY_HOSTS)
|
||||
|
||||
self.assertEqual(len(discovered), 1)
|
||||
self.assertEqual(discovered[0].references, ())
|
||||
|
||||
|
||||
def test_certificate_discovery_excludes_secret_material(self):
|
||||
client = Mock()
|
||||
client.certificates.return_value = [
|
||||
|
||||
Reference in New Issue
Block a user