Skip to content

Commit c20d38f

Browse files
authored
Fix test_predict: use correct schema fields, assert is_anomaly in response
Updated the test payload to include 'bytes_transferred', 'event_type', and 'details'. Changed assertions to check for 'is_anomaly' instead of multiple keys.
1 parent c8e39ce commit c20d38f

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

backend/tests/test_predict.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ def test_predict_endpoint():
77
payload = {
88
"source_ip": "10.0.0.1",
99
"destination_ip": "10.0.0.2",
10-
"bytes_sent": 1000,
11-
"bytes_received": 2000,
1210
"protocol": "TCP",
13-
"failed_login_count": 0
11+
"bytes_transferred": 1000,
12+
"event_type": "normal",
13+
"details": "test prediction"
1414
}
1515
resp = client.post("/predict/", json=payload)
1616
assert resp.status_code == 200
1717
body = resp.json()
18-
for key in ("score", "label", "confidence"):
19-
assert key in body
18+
assert "is_anomaly" in body

0 commit comments

Comments
 (0)