feat: a managed device names its driver and how to reach it
driver / standard (pull_request) Successful in 22s
driver / lint (pull_request) Successful in 20s
driver / types (pull_request) Successful in 54s
driver / lowest (pull_request) Successful in 53s
driver / test (3.13) (pull_request) Successful in 1m8s
driver / build (pull_request) Successful in 34s
driver / test (3.12) (pull_request) Successful in 1m39s
driver / security (pull_request) Successful in 1m3s
CI / driver (pull_request) Successful in 2m19s
driver / publish (pull_request) Skipped

ManagedDeviceDict gets two optional keys: driver, the entry point that
polls the device, and driver_args, the optional args that reach it through
the controller (never a secret). With them a caller can add a controller's
devices without knowing the vendor (NetOrk/netork#2787).
This commit is contained in:
christianmanivong committed 2026-12-05 17:16:32 +01:00
1 parent d5ffb0f0fa
commit 081ef62d22
4 files changed
+26 -4

No files matched your search

+13 -1
View File
@@ -54,12 +54,24 @@ class TestManagedDeviceDict:
def test_optional_keys(self):
assert ManagedDeviceDict.__optional_keys__ == frozenset(
{"id", "serial", "model_name", "firmware", "firmware_available"}
{
"id",
"serial",
"model_name",
"firmware",
"firmware_available",
"driver",
"driver_args",
}
)
def test_every_annotation_resolves(self):
hints = typing.get_type_hints(ManagedDeviceDict)
assert hints["ip"] == str | None
assert hints["driver_args"] == dict[str, typing.Any]
def test_the_docstring_keeps_secrets_out_of_driver_args(self):
assert "never a secret" in " ".join((ManagedDeviceDict.__doc__ or "").lower().split())
def test_roles_and_states_are_exported_words(self):
assert package.MANAGED_DEVICE_ROLES == ("switch", "access_point", "gateway", "other")