Mechanical: ruff format, and ruff check --fix with the rule set every NAPALM driver uses (E, F, I, UP, B at line length 100, Python 3.10). What ruff cannot fix comes in the next commit.
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
"""Tests for get_facts."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from tests.conftest import NODE_NETWORK
|
|
|
|
|
|
@pytest.fixture
|
|
def facts(driver):
|
|
return driver.get_facts()
|
|
|
|
|
|
class TestGetFacts:
|
|
def test_vendor(self, facts):
|
|
assert "Proxmox" in facts["vendor"]
|
|
|
|
def test_model(self, facts):
|
|
assert facts["model"] == "PowerEdge R640"
|
|
|
|
def test_hostname(self, facts):
|
|
assert facts["hostname"] == "pve1"
|
|
|
|
def test_os_version_contains_version(self, facts):
|
|
assert "8.2.4" in facts["os_version"]
|
|
|
|
def test_uptime_is_float(self, facts):
|
|
assert isinstance(facts["uptime"], float)
|
|
assert facts["uptime"] == 123456.0
|
|
|
|
def test_interface_list_sorted(self, facts):
|
|
expected = sorted(i["iface"] for i in NODE_NETWORK if i.get("iface"))
|
|
assert facts["interface_list"] == expected
|
|
|
|
def test_fqdn(self, facts):
|
|
assert facts["fqdn"] == "pve1.example.com"
|
|
|
|
def test_serial_number_is_string(self, facts):
|
|
assert isinstance(facts["serial_number"], str)
|