43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
"""Tests for get_facts."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
from tests.conftest import _build_mock_api, NODE_NETWORK
|
|
from unittest.mock import patch
|
|
|
|
from napalm_proxmox.driver import ProxmoxDriver
|
|
|
|
|
|
@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)
|