Initial commit: Check-My-IRVE SaaS (OCPP 1.6, Audit, Diagnostics)
This commit is contained in:
commit
192be86487
44 changed files with 2070 additions and 0 deletions
36
backend/tests/test_diagnostics.py
Normal file
36
backend/tests/test_diagnostics.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'app')))
|
||||
|
||||
from core.diagnostics import analyze_frames
|
||||
|
||||
def test_missing_status_after_boot():
|
||||
frames = [
|
||||
{"action": "BootNotification", "uniqueId": "1", "payload": {}},
|
||||
{"action": "Heartbeat", "uniqueId": "2", "payload": {}}
|
||||
]
|
||||
findings = analyze_frames(frames, {})
|
||||
assert len(findings) == 1
|
||||
assert findings[0]["id"] == "NO_STATUS_AFTER_BOOT"
|
||||
|
||||
def test_no_finding_when_status_present():
|
||||
frames = [
|
||||
{"action": "BootNotification", "uniqueId": "1", "payload": {}},
|
||||
{"action": "StatusNotification", "uniqueId": "2", "payload": {"status": "Available"}}
|
||||
]
|
||||
findings = analyze_frames(frames, {})
|
||||
assert len(findings) == 0
|
||||
|
||||
def test_clock_drift_none():
|
||||
findings = analyze_frames([], {"clock_drift": None})
|
||||
assert len(findings) == 0
|
||||
|
||||
def test_clock_drift_critical():
|
||||
findings = analyze_frames([], {"clock_drift": 120})
|
||||
assert len(findings) == 1
|
||||
assert findings[0]["id"] == "CLOCK_DRIFT"
|
||||
|
||||
def test_abnormal_disconnect():
|
||||
findings = analyze_frames([], {"last_disconnect_code": 1006})
|
||||
assert len(findings) == 1
|
||||
assert findings[0]["id"] == "ABNORMAL_DISCONNECT"
|
||||
Loading…
Add table
Add a link
Reference in a new issue