File size: 749 Bytes
1a73f90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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