MalwareGuard / backend /tests /test_feedback.py
HeshamXOR's picture
Deploy MalwareGuard FastAPI backend clean
1a73f90 verified
Raw History Blame Contribute Delete
749 Bytes
def test_feedback_log_and_stats_happy_path(client, features, sha256):
log_response = client.post(
"/api/feedback/malware",
json={
"features": features,
"sha256": sha256,
"predicted_label": "Malicious",
"predicted_probability": 0.91,
"vt_malicious_count": 5,
"vt_total_engines": 20,
"vt_detection_ratio": 0.25,
},
)
assert log_response.status_code == 200
assert log_response.json()["total_feedback_count"] == 1
stats_response = client.get("/api/feedback/stats")
assert stats_response.status_code == 200
stats = stats_response.json()
assert stats["malware_total"] == 1
assert stats["malware_agree"] == 1