"""What the driver still names itself (netOrk #1111). lldpd, auc and the pending updates are facts the caller reads (``get_packages``, ``get_available_updates``) and decides on. A missing ``base64`` stays: BusyBox may provide it as an applet, so no package says whether it is there. """ from __future__ import annotations from napalm_openwrt import OpenWrtDriver def _driver(answers: dict[str, str]) -> OpenWrtDriver: d = OpenWrtDriver("ap", "root", "pw") issued: list[str] = [] def send(command: str) -> str: issued.append(command) return next((out for frag, out in answers.items() if frag in command), "") d._send_command = send d.issued = issued return d def test_nothing_installed_names_only_base64(): """No lldpd, no auc and an opkg system: the caller names those from the packages.""" d = _driver({"opkg list-upgradable": "luci - 1.0 - 1.1\n"}) assert [w["code"] for w in d.get_device_warnings()] == ["no_base64"] def test_base64_present_names_nothing(): d = _driver({"command -v base64": "/usr/bin/base64\n"}) assert d.get_device_warnings() == [] def test_one_command_per_poll(): d = _driver({}) d.get_device_warnings() assert d.issued == ["command -v base64 2>/dev/null"]