mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-01-23 14:19:04 -05:00
New Features: - API endpoints now support comprehensive input validation with detailed error responses via Pydantic models. - OpenAPI specification endpoint (/openapi.json) and interactive Swagger UI documentation (/docs) now available for API discovery. - Enhanced MCP session lifecycle management with create, retrieve, and delete operations. - Network diagnostic tools: traceroute, nslookup, NMAP scanning, and network topology viewing exposed via API. - Device search, filtering by status (including 'offline'), and bulk operations (copy, delete, update). - Wake-on-LAN functionality for remote device management. - Added dynamic tool disablement and status reporting. Bug Fixes: - Fixed get_tools_status in registry to correctly return boolean values instead of None for enabled tools. - Improved error handling for invalid API inputs with standardized validation responses. - Fixed OPTIONS request handling for cross-origin requests. Refactoring: - Significant refactoring of api_server_start.py to use decorator-based validation (@validate_request).
19 lines
724 B
Python
19 lines
724 B
Python
from front.plugins.plugin_helper import is_mac, normalize_mac
|
|
|
|
|
|
def test_is_mac_accepts_wildcard():
|
|
assert is_mac("AA:BB:CC:*") is True
|
|
assert is_mac("aa-bb-cc:*") is True # mixed separator
|
|
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():
|
|
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}'"
|
|
assert normalize_mac("aa:bb:cc:dd:ee:ff") == "AA:BB:CC:DD:EE:FF"
|