first commit

This commit is contained in:
2026-08-23 09:52:32 +02:00
commit 1a7ed8ef94
94 changed files with 10489 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
from pathlib import Path
import unittest
from librenet_scanner.identity import os_family
from librenet_scanner.models import Host
from librenet_scanner.visual_identity import OS_ICON_FILES, os_icon_key_for_host
class V0415OsIconsTests(unittest.TestCase):
def test_windows_still_supported(self):
self.assertEqual(os_icon_key_for_host(Host(ip="192.0.2.10", os_name="Microsoft Windows 11")), "windows")
def test_apple_platforms(self):
for value in (
"Apple macOS 14.5",
"Apple Mac OS X 10.15.7",
"Darwin 23.5.0",
"iPhone OS 17.6",
"iPadOS 18.0",
"Apple iOS 17.6",
"Apple TV tvOS 17",
):
with self.subTest(value=value):
self.assertEqual(os_icon_key_for_host(Host(ip="192.0.2.11", os_name=value)), "apple")
def test_android_wins_over_linux(self):
self.assertEqual(
os_icon_key_for_host(Host(ip="192.0.2.12", os_name="Linux 5.10 (Android 14)")),
"android",
)
def test_identity_families_match_visual_families(self):
self.assertEqual(os_family("Android 14 (Linux 5.10)"), "android")
self.assertEqual(os_family("Apple macOS 15"), "apple")
self.assertEqual(os_family("Windows 11"), "windows")
self.assertNotEqual(os_icon_key_for_host(Host(ip="192.0.2.13", os_name="Cisco IOS 15.2")), "apple")
self.assertEqual(os_family("Cisco IOS XE 17.9"), "iosxe")
def test_assets_are_packaged_sources(self):
root = Path(__file__).resolve().parents[1]
for key in ("apple", "android", "windows", "linux", "bsd"):
filename = OS_ICON_FILES[key]
icon = root / "assets" / "icons" / filename
self.assertTrue(icon.is_file(), f"missing {filename}")
self.assertGreater(icon.stat().st_size, 200)
self.assertIn("Font Awesome", (root / "THIRD_PARTY_ASSETS.md").read_text())
if __name__ == "__main__":
unittest.main()