feat: switch off the fix templates QTS cannot take (0.4.0)
CI / test (3.10) (push) Successful in 38s
CI / test (3.11) (push) Successful in 35s
CI / test (3.12) (push) Successful in 35s
CI / test (3.10) (pull_request) Successful in 31s
CI / test (3.11) (pull_request) Successful in 30s
CI / test (3.12) (pull_request) Successful in 32s
CI / test (3.10) (push) Successful in 38s
CI / test (3.11) (push) Successful in 35s
CI / test (3.12) (push) Successful in 35s
CI / test (3.10) (pull_request) Successful in 31s
CI / test (3.11) (pull_request) Successful in 30s
CI / test (3.12) (pull_request) Successful in 32s
napalm-linux 0.8 implements napalm-device-types' fix templates. QTS has no apt, dnf or opkg and sets its SNMP agent in its own UI, so configure_snmp_agent, configure_package_proxy and ensure_package are None here: a capability check answers no instead of offering a fix that fails, as the inherited fix_snmp and fix_apt_proxy did. get_device_warnings returns nothing: the inherited one asked for updates, which is None here, and logged a TypeError on every poll. The role test follows napalm-linux's get_os_users. Closes #6. Part of #7.
This commit is contained in:
1 parent
088d47f47c
commit
95ec6ad33b
4 files changed
+44
-4
No files matched your search
+21
-2
@@ -10,8 +10,8 @@ from __future__ import annotations
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from napalm_device_types import primary_role_of, role_keys_of
|
||||
|
||||
from napalm_qnap_qts import QnapQtsDriver
|
||||
|
||||
#: Parsers need real command output to be written against. These tests are the
|
||||
@@ -97,7 +97,7 @@ class TestRolesDoNotShadowLinux:
|
||||
collision. There is nothing left to collide with.
|
||||
"""
|
||||
|
||||
@pytest.mark.parametrize("method", ["get_services", "get_users"])
|
||||
@pytest.mark.parametrize("method", ["get_services", "get_os_users"])
|
||||
def test_os_surface_resolves_to_linux(self, method):
|
||||
"""QTS really is Linux for these, so inheriting them is correct."""
|
||||
from napalm_linux.linux import LinuxDriver
|
||||
@@ -224,3 +224,22 @@ def test_updates_are_not_read_or_applied_here():
|
||||
methods are callable."""
|
||||
for method in ("get_available_updates", "refresh_available_updates", "apply_updates"):
|
||||
assert not callable(getattr(QnapQtsDriver, method, None)), method
|
||||
|
||||
|
||||
class TestFixesQtsCannotTake:
|
||||
"""QTS has no apt, dnf or opkg, and its SNMP agent is configured in its own UI:
|
||||
the fix templates inherited from LinuxDriver are switched off (#7), so a
|
||||
capability check -- is it callable? -- answers no."""
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"name", ["configure_snmp_agent", "configure_package_proxy", "ensure_package"]
|
||||
)
|
||||
def test_switched_off(self, name):
|
||||
assert getattr(QnapQtsDriver, name) is None
|
||||
|
||||
|
||||
def test_device_warnings_do_not_ask_for_updates_qts_cannot_list():
|
||||
"""The inherited get_device_warnings called get_available_updates, which is
|
||||
None here, and logged a TypeError on every poll (#6)."""
|
||||
driver = QnapQtsDriver("nas", "admin", "pw")
|
||||
assert driver.get_device_warnings() == []
|
||||
Reference in new issue
Block a user