fix(driver): load_replace_candidate is None, not a stub that raises (NetOrk/netork#2503)
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 11s
driver / test (3.12) (pull_request) Successful in 49s
driver / types (pull_request) Successful in 51s
driver / test (3.13) (pull_request) Successful in 45s
driver / lowest (pull_request) Successful in 22s
driver / build (pull_request) Successful in 26s
driver / security (pull_request) Successful in 56s
CI / driver (pull_request) Successful in 2m13s
driver / publish (pull_request) Skipped
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 11s
driver / test (3.12) (pull_request) Successful in 49s
driver / types (pull_request) Successful in 51s
driver / test (3.13) (pull_request) Successful in 45s
driver / lowest (pull_request) Successful in 22s
driver / build (pull_request) Successful in 26s
driver / security (pull_request) Successful in 56s
CI / driver (pull_request) Successful in 2m13s
driver / publish (pull_request) Skipped
The driver cannot replace a device's configuration, and said so with a load_replace_candidate that raised NotImplementedError. A method that only raises still looks like a replace to anyone who asks whether the driver has one: netOrk offered a config restore for these devices that could only fail. None is how a driver switches off a method, the convention netOrk's capability checks and napalm-device-types follow, so asking now says no. Nothing in the driver calls it.
This commit is contained in:
1 parent
9ff75eb152
commit
a37802cf88
5 files changed
+26
-12
No files matched your search
@@ -0,0 +1,17 @@
|
||||
"""The driver cannot replace a device's configuration, and says so by not having the method.
|
||||
|
||||
A ``load_replace_candidate`` that only raises looks like a replace to anyone who asks
|
||||
whether the driver has one: netOrk offered a config restore for these devices that
|
||||
could only fail (NetOrk/netork#2503). ``None`` is how a driver switches off a method
|
||||
it would otherwise inherit, the convention of napalm-device-types and netOrk's
|
||||
capability checks.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from napalm_zyxel import ZyxelVMGDriver
|
||||
|
||||
|
||||
def test_the_driver_has_no_config_replace():
|
||||
assert ZyxelVMGDriver.load_replace_candidate is None
|
||||
assert not callable(getattr(ZyxelVMGDriver, "load_replace_candidate", None))
|
||||
@@ -292,11 +292,6 @@ class TestZyxelVMGDriver:
|
||||
assert not hasattr(type(self.driver), "run_device_action")
|
||||
assert not hasattr(type(self.driver), "reboot")
|
||||
|
||||
def test_load_replace_candidate_raises(self):
|
||||
self._setup_mocked_http()
|
||||
with pytest.raises(NotImplementedError):
|
||||
self.driver.load_replace_candidate()
|
||||
|
||||
def test_load_merge_candidate_raises(self):
|
||||
self._setup_mocked_http()
|
||||
with pytest.raises(NotImplementedError):
|
||||
|
||||
Reference in new issue
Block a user