Spaces:
Running
Running
Download backend/tests/test_feedback.py from HeshamXOR/MalwareGuard: direct link, hf CLI and curl.
- Browser
- Download file 749 Bytes
-
https://huggingface.co/spaces/HeshamXOR/MalwareGuard/resolve/main/backend/tests/test_feedback.py
- Command line
-
hf download hf://spaces/HeshamXOR/MalwareGuard/backend/tests/test_feedback.py
-
curl -L -o test_feedback.py https://huggingface.co/spaces/HeshamXOR/MalwareGuard/resolve/main/backend/tests/test_feedback.py
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 | |