bug in zyxel
This commit is contained in:
+23
-1
@@ -3,7 +3,7 @@ from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
from unittest.mock import patch
|
||||
|
||||
from lib._zyxel import normalize_mac
|
||||
from lib._zyxel import ZyxelRouter, normalize_mac
|
||||
from lib._arrival_detection import ArrivalDetector, _notify
|
||||
|
||||
|
||||
@@ -35,6 +35,28 @@ class MacTests(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
normalize_mac("not-a-mac")
|
||||
|
||||
def test_parses_ex5601_nested_lanhosts_response(self):
|
||||
router = ZyxelRouter("192.0.2.1", "user", "password")
|
||||
router.dal_get = lambda _oid: {
|
||||
"result": "ZCFG_SUCCESS",
|
||||
"Object": [
|
||||
{
|
||||
"lanhosts": [
|
||||
{
|
||||
"PhysAddress": "2C:DB:07:50:2B:5C",
|
||||
"Active": True,
|
||||
"HostName": "workstation",
|
||||
"IPAddress": "192.168.178.10",
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
}
|
||||
hosts = router.get_lan_hosts()
|
||||
self.assertEqual(len(hosts), 1)
|
||||
self.assertEqual(hosts[0].mac, "2c:db:07:50:2b:5c")
|
||||
self.assertTrue(router.is_connected("2c-db-07-50-2b-5c"))
|
||||
|
||||
|
||||
class NotificationTests(unittest.TestCase):
|
||||
@patch("lib._arrival_detection.send_notification")
|
||||
|
||||
Reference in New Issue
Block a user