UnifiNetworkDriver names the devices a controller manages: through the Integration API, with the devices still waiting for adoption on Network 10, and through the classic API on controllers without it. Its own ports are none of its devices'. Every entry point is checked against its driver.
21 lines
641 B
Python
21 lines
641 B
Python
"""Each NAPALM entry point names a driver of that name."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import importlib
|
|
import pathlib
|
|
import tomllib
|
|
|
|
PYPROJECT = pathlib.Path(__file__).parents[1] / "pyproject.toml"
|
|
|
|
|
|
def test_every_entry_point_loads_the_driver_it_names() -> None:
|
|
points = tomllib.loads(PYPROJECT.read_text())["project"]["entry-points"]["napalm.drivers"]
|
|
|
|
for name, target in points.items():
|
|
module, attribute = target.split(":")
|
|
driver = getattr(importlib.import_module(module), attribute)
|
|
assert driver.DRIVER_NAME == name
|
|
|
|
assert set(points) == {"unifi_switch", "unifi_ap", "unifi_network"}
|