Files
NetAlertX/test/test_plugin_helper.py
T
Jokob @NetAlertX 9e38cfd8b4 Add website monitoring plugin and update workflows configuration
- Introduced a new plugin for monitoring website health, including functionality to check URLs and log results.
- Created README and configuration files for the workflows plugin, detailing its purpose and settings.
- Updated import paths in various test files to reflect the new directory structure.
- Ensured compatibility of test cases with the updated plugin architecture.
2026-08-10 02:32:49 +00:00

30 lines
1.1 KiB
Python

from server.plugins.plugin_helper import is_mac, normalize_mac
def test_is_mac_accepts_wildcard():
# is_mac checks structure, so it should still return True
assert is_mac("aa:bb:cc:*") is True
assert is_mac("AA-BB-CC:*") is True # mixed case/separator should still be recognized
assert is_mac("00:11:22:33:44:55") is True
assert is_mac("00-11-22-33-44-55") is True
assert is_mac("not-a-mac") is False
def test_normalize_mac_preserves_wildcard():
# UPDATED: Expected results are now lowercase to match the DB standard
assert normalize_mac("aa:bb:cc:*") == "aa:bb:cc:*"
assert normalize_mac("AA-BB-CC-*") == "aa:bb:cc:*"
# Call once and assert deterministic result
result = normalize_mac("aabbcc*")
assert result == "aa:bb:cc:*", f"Expected 'aa:bb:cc:*' but got '{result}'"
# Ensure full MACs are lowercase too
assert normalize_mac("AA:BB:CC:DD:EE:FF") == "aa:bb:cc:dd:ee:ff"
def test_normalize_mac_preserves_internet_root():
# Stays lowercase
assert normalize_mac("internet") == "internet"
assert normalize_mac("Internet") == "internet"
assert normalize_mac("INTERNET") == "internet"