fix: report FreeBSD and OpenBSD hosts in the role bsd
BsdDriver set no ROLE, so both drivers inherited OSDriver's "linux" and an application that shows or branches on the role treated a BSD host as a Linux one. One key for both systems. Closes #10
This commit is contained in:
1 parent
405239d5df
commit
ce4a677756
4 files changed
+16
-3
No files matched your search
@@ -6,7 +6,7 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from napalm.base import NetworkDriver
|
||||
from napalm_device_types import OSDriver
|
||||
from napalm_device_types import OSDriver, primary_role_of, role_keys_of
|
||||
|
||||
from napalm_bsd import FreeBSDDriver, OpenBSDDriver, base
|
||||
from napalm_bsd.base import BsdDriver
|
||||
@@ -106,6 +106,12 @@ class TestIdentity:
|
||||
assert getattr(cls, getter) is not getattr(NetworkDriver, getter, None)
|
||||
assert getattr(cls, getter) is not getattr(OSDriver, getter, None)
|
||||
|
||||
@pytest.mark.parametrize("cls", [FreeBSDDriver, OpenBSDDriver])
|
||||
def test_the_role_is_bsd_not_linux(self, cls):
|
||||
"""One key for both BSDs (#10); OSDriver's inherited "linux" would call them Linux."""
|
||||
assert role_keys_of(cls) == ["bsd"]
|
||||
assert primary_role_of(cls) == "bsd"
|
||||
|
||||
@pytest.mark.parametrize("cls", [FreeBSDDriver, OpenBSDDriver])
|
||||
def test_leaves_napalms_get_users_alone(self, cls):
|
||||
"""NAPALM's get_users is a different getter; the host's accounts are get_os_users."""
|
||||
|
||||
Reference in new issue
Block a user