33 lines
1.5 KiB
Python
33 lines
1.5 KiB
Python
import unittest
|
|
|
|
from librenet_scanner.models import Host
|
|
from librenet_scanner.visual_identity import device_icon_key_for_host, os_icon_key_for_host
|
|
|
|
|
|
class VisualIdentitySplitRegressionTests(unittest.TestCase):
|
|
"""0.4.12 deliberately replaces the product-specific 0.4.11 icon model."""
|
|
|
|
def test_openwrt_is_linux_os_but_network_equipment_type_is_independent(self):
|
|
host = Host("192.0.2.1", os_name="OpenWrt 23.05", device_type="Équipement réseau")
|
|
self.assertEqual(os_icon_key_for_host(host), "linux")
|
|
self.assertEqual(device_icon_key_for_host(host), "network-device")
|
|
|
|
def test_opnsense_is_bsd_os_and_firewall_equipment(self):
|
|
host = Host("192.0.2.3", hostname="opns01.local", os_name="FreeBSD 13", device_type="Pare-feu / routeur")
|
|
self.assertEqual(os_icon_key_for_host(host), "bsd")
|
|
self.assertEqual(device_icon_key_for_host(host), "firewall")
|
|
|
|
def test_proxmox_is_linux_os_and_hypervisor_equipment(self):
|
|
host = Host("192.0.2.4", os_name="Linux 6.x", device_type="Hyperviseur Proxmox")
|
|
self.assertEqual(os_icon_key_for_host(host), "linux")
|
|
self.assertEqual(device_icon_key_for_host(host), "hypervisor")
|
|
|
|
def test_windows_workstation_is_windows_os_and_workstation_equipment(self):
|
|
host = Host("192.0.2.2", os_name="Microsoft Windows 11", device_type="Poste / serveur Windows")
|
|
self.assertEqual(os_icon_key_for_host(host), "windows")
|
|
self.assertEqual(device_icon_key_for_host(host), "workstation")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|