Add DSM 5 SYNO.DSM.Network test (#45)

This commit is contained in:
Quentame
2020-05-02 14:56:40 +02:00
committed by GitHub
parent a398d3a952
commit 5f9c2dd96a
4 changed files with 35 additions and 0 deletions

View File

@ -35,6 +35,7 @@ from .api_data.dsm_5 import (
DSM_5_AUTH_LOGIN,
DSM_5_AUTH_LOGIN_2SA,
DSM_5_AUTH_LOGIN_2SA_OTP,
DSM_5_DSM_NETWORK,
DSM_5_DSM_INFORMATION,
DSM_5_CORE_UTILIZATION,
DSM_5_STORAGE_STORAGE_DS410J_RAID5_4DISKS_1VOL,
@ -47,6 +48,7 @@ API_SWITCHER = {
"AUTH_LOGIN_2SA": DSM_5_AUTH_LOGIN_2SA,
"AUTH_LOGIN_2SA_OTP": DSM_5_AUTH_LOGIN_2SA_OTP,
"DSM_INFORMATION": DSM_5_DSM_INFORMATION,
"DSM_NETWORK": DSM_5_DSM_NETWORK,
"CORE_UTILIZATION": DSM_5_CORE_UTILIZATION,
"STORAGE_STORAGE": {"RAID": DSM_5_STORAGE_STORAGE_DS410J_RAID5_4DISKS_1VOL,},
},

View File

@ -7,6 +7,7 @@ from .const_5_api_auth import (
)
from .core.const_5_core_utilization import DSM_5_CORE_UTILIZATION
from .dsm.const_5_dsm_info import DSM_5_DSM_INFORMATION
from .dsm.const_5_dsm_network import DSM_5_DSM_NETWORK
from .storage.const_5_storage_storage import (
DSM_5_STORAGE_STORAGE_DS410J_RAID5_4DISKS_1VOL,
)

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
"""DSM 5 SYNO.DSM.Network data."""
DSM_5_DSM_NETWORK = {
"data": {
"dns": ["192.168.1.1"],
"gateway": "192.168.1.1",
"hostname": "HOME-NAS",
"interfaces": [
{
"id": "eth0",
"ip": [{"address": "192.168.1.10", "netmask": "255.255.255.0"}],
"mac": "XX-XX-XX-XX-XX-XX",
"type": "lan",
}
],
"workgroup": "WORKGROUP",
},
"success": True,
}

View File

@ -210,6 +210,18 @@ class TestSynologyDSM(TestCase):
assert self.api.information.version == "5967"
assert self.api.information.version_string == "DSM 5.2-5967 Update 9"
def test_network(self):
"""Test network."""
assert self.api.network
assert self.api.network.dns
assert self.api.network.gateway
assert self.api.network.hostname
assert self.api.network.interfaces
assert self.api.network.interface("eth0")
assert self.api.network.interface("eth1") is None
assert self.api.network.macs
assert self.api.network.workgroup
def test_utilisation(self):
"""Test utilization."""
assert self.api.utilisation