feat: name only a missing base64; lldpd, auc and updates are facts (0.3.0)
CI / test (3.10) (push) Successful in 26s
CI / test (3.11) (push) Successful in 23s
CI / test (3.12) (push) Successful in 26s
CI / test (3.10) (pull_request) Successful in 24s
CI / test (3.11) (pull_request) Successful in 22s
CI / test (3.12) (pull_request) Successful in 25s
CI / test (3.10) (push) Successful in 26s
CI / test (3.11) (push) Successful in 23s
CI / test (3.12) (push) Successful in 26s
CI / test (3.10) (pull_request) Successful in 24s
CI / test (3.11) (pull_request) Successful in 22s
CI / test (3.12) (pull_request) Successful in 25s
get_device_warnings no longer names lldpd_not_installed, updates_available or update_notifications_disabled. The packages and get_available_updates are the facts; netOrk derives the warnings with the same reach (netOrk #1111). The old update read swallowed failures, get_available_updates raises them. no_base64 stays: BusyBox may provide base64 as an applet, so no package tells the caller whether it is there.
This commit is contained in:
1 parent
9f43b8c797
commit
34d80bd994
3 files changed
+53
-62
No files matched your search
@@ -0,0 +1,43 @@
|
||||
"""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"]
|
||||
Reference in new issue
Block a user