Add external adapter plugin boundary
This commit is contained in:
@@ -22,6 +22,8 @@ class VerizonAdapterTests(unittest.TestCase):
|
||||
{
|
||||
"NPM_ENDPOINTS": "192.168.1.3",
|
||||
"VERIZON_ENDPOINTS": "192.168.1.1",
|
||||
"ENABLED_PLUGINS": "npm,verizon",
|
||||
"DNS_SYNC_PLUGIN_PATH": "external_plugins",
|
||||
},
|
||||
clear=True,
|
||||
):
|
||||
@@ -29,16 +31,37 @@ class VerizonAdapterTests(unittest.TestCase):
|
||||
|
||||
def adapter(self, provider):
|
||||
config = self.config()
|
||||
with patch(
|
||||
"dns_sync.plugins.adapters.verizon.VerizonProvider",
|
||||
return_value=provider,
|
||||
|
||||
import dns_sync.registry as registry
|
||||
|
||||
with patch.dict(
|
||||
os.environ,
|
||||
{
|
||||
"ENABLED_PLUGINS": "npm,verizon",
|
||||
"DNS_SYNC_PLUGIN_PATH": "external_plugins",
|
||||
},
|
||||
clear=False,
|
||||
):
|
||||
return load_adapter(
|
||||
"verizon",
|
||||
config,
|
||||
config.verizon_endpoints[0],
|
||||
module = registry._load_external_adapter_module(
|
||||
"verizon"
|
||||
)
|
||||
|
||||
if module is None:
|
||||
raise AssertionError(
|
||||
"external Verizon adapter was not found"
|
||||
)
|
||||
|
||||
with patch.object(
|
||||
module,
|
||||
"VerizonProvider",
|
||||
return_value=provider,
|
||||
):
|
||||
return load_adapter(
|
||||
"verizon",
|
||||
config,
|
||||
config.verizon_endpoints[0],
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def dns_object(
|
||||
hostname="app.example.com",
|
||||
@@ -85,6 +108,8 @@ class VerizonAdapterTests(unittest.TestCase):
|
||||
{
|
||||
"NPM_ENDPOINTS": "192.168.1.3",
|
||||
"VERIZON_ENDPOINTS": "192.168.1.1:8443",
|
||||
"ENABLED_PLUGINS": "npm,verizon",
|
||||
"DNS_SYNC_PLUGIN_PATH": "external_plugins",
|
||||
"ROUTER_URL": "https://192.168.1.254",
|
||||
"ROUTER_PASSWORD": "not-a-real-password",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user