test: placeholders for the serial number and MAC addresses in fixtures
driver / lint (pull_request) Successful in 16s
driver / standard (pull_request) Successful in 18s
driver / types (pull_request) Successful in 1m5s
driver / test (3.13) (pull_request) Successful in 57s
driver / test (3.12) (pull_request) Successful in 1m13s
driver / lowest (pull_request) Successful in 27s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m13s
CI / driver (pull_request) Successful in 2m28s
driver / publish (pull_request) Skipped

The fixtures are a real gateway's answers. Its serial number and its MAC
addresses identify that one device and do not belong in a public
repository; the tests only need values of the right shape. The MACs keep
Zyxel's OUI.
This commit is contained in:
Christian Manivong committed 2026-11-12 18:32:40 +01:00
1 parent 23dbfb7650
commit a282836bd2
2 files changed
+9 -8

No files matched your search

+4 -3
View File
@@ -12,7 +12,8 @@ from (#27).
``BASIC_INFO`` and ``SYSTEM`` are those two answers from that gateway (the SNMP ``BASIC_INFO`` and ``SYSTEM`` are those two answers from that gateway (the SNMP
community strings the System answer can carry are left out), ``STATUS`` its community strings the System answer can carry are left out), ``STATUS`` its
``cardpage_status`` cut down to ``DeviceInfo`` and one interface. ``cardpage_status`` cut down to ``DeviceInfo`` and one interface, with the serial
number replaced by a placeholder.
""" """
from __future__ import annotations from __future__ import annotations
@@ -46,7 +47,7 @@ STATUS: dict[str, Any] = {
{ {
"DeviceInfo": { "DeviceInfo": {
"ModelName": "VMG4005-B50A", "ModelName": "VMG4005-B50A",
"SerialNumber": "S250Y02049498", "SerialNumber": "S000Y00000001",
"SoftwareVersion": "V5.17(ABQA.3.1)C0", "SoftwareVersion": "V5.17(ABQA.3.1)C0",
"UpTime": 13544274, "UpTime": 13544274,
}, },
@@ -145,7 +146,7 @@ def test_get_facts_raises_on_a_system_page_it_cannot_read(answer: Any):
def test_the_serial_number_is_the_one_on_the_status_page(): def test_the_serial_number_is_the_one_on_the_status_page():
assert _driver().get_facts()["serial_number"] == "S250Y02049498" assert _driver().get_facts()["serial_number"] == "S000Y00000001"
def test_the_uptime_is_the_one_on_the_status_page(): def test_the_uptime_is_the_one_on_the_status_page():
+5 -5
View File
@@ -8,7 +8,7 @@ all of that. Both now read the DAL's ``cardpage_status``: the IP interfaces in
yet: the gateway this was taken from has IPv6 off and so shows none to learn from. yet: the gateway this was taken from has IPv6 off and so shows none to learn from.
``CARDPAGE`` is that answer from a VMG4005-B50A (V5.17(ABQA.3.1)C0), cut down to the ``CARDPAGE`` is that answer from a VMG4005-B50A (V5.17(ABQA.3.1)C0), cut down to the
fields the driver reads. fields the driver reads, with placeholder MAC addresses under Zyxel's OUI.
""" """
from __future__ import annotations from __future__ import annotations
@@ -30,7 +30,7 @@ CARDPAGE: dict[str, Any] = {
{ {
"Enable": True, "Enable": True,
"X_ZYXEL_Type": "LAN", "X_ZYXEL_Type": "LAN",
"MACAddress": "6c:4f:89:6a:bf:50", "MACAddress": "6c:4f:89:00:00:50",
"Status": "Up", "Status": "Up",
"X_ZYXEL_SrvName": "Default", "X_ZYXEL_SrvName": "Default",
"Name": "LAN", "Name": "LAN",
@@ -73,7 +73,7 @@ CARDPAGE: dict[str, Any] = {
"Enable": True, "Enable": True,
"Status": "Up", "Status": "Up",
"Name": "eth1", "Name": "eth1",
"MACAddress": "6c:4f:89:6a:bf:53", "MACAddress": "6c:4f:89:00:00:53",
"MaxBitRate": 1000, "MaxBitRate": 1000,
"X_ZYXEL_LanPort": "LAN1", "X_ZYXEL_LanPort": "LAN1",
} }
@@ -133,7 +133,7 @@ def test_an_ip_interface_is_up_only_when_the_gateway_says_so():
def test_an_ip_interface_carries_its_own_mac_and_name(): def test_an_ip_interface_carries_its_own_mac_and_name():
br0 = _driver(CARDPAGE).get_interfaces()["br0"] br0 = _driver(CARDPAGE).get_interfaces()["br0"]
assert br0["mac_address"] == "6c:4f:89:6a:bf:50" assert br0["mac_address"] == "6c:4f:89:00:00:50"
assert br0["description"] == "LAN" assert br0["description"] == "LAN"
assert br0["is_enabled"] is True assert br0["is_enabled"] is True
@@ -145,7 +145,7 @@ def test_a_wan_bridge_is_named_after_its_service():
def test_an_ethernet_port_carries_its_speed_mac_and_label(): def test_an_ethernet_port_carries_its_speed_mac_and_label():
eth1 = _driver(CARDPAGE).get_interfaces()["eth1"] eth1 = _driver(CARDPAGE).get_interfaces()["eth1"]
assert eth1["speed"] == 1000.0 assert eth1["speed"] == 1000.0
assert eth1["mac_address"] == "6c:4f:89:6a:bf:53" assert eth1["mac_address"] == "6c:4f:89:00:00:53"
assert eth1["description"] == "LAN1" assert eth1["description"] == "LAN1"
assert eth1["is_up"] is True assert eth1["is_up"] is True