Skip to content

Commit b538597

Browse files
authored
fix: use conftest client fixture in test_predict.py + assert anomaly_score in response
1 parent c81788d commit b538597

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

backend/tests/test_predict.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import pytest
12
from fastapi.testclient import TestClient
23
from backend.main import app
34

4-
client = TestClient(app)
55

6-
def test_predict_endpoint():
6+
def test_predict_endpoint(client):
77
payload = {
88
"source_ip": "10.0.0.1",
99
"destination_ip": "10.0.0.2",
@@ -18,3 +18,4 @@ def test_predict_endpoint():
1818
if resp.status_code == 200:
1919
body = resp.json()
2020
assert "is_anomaly" in body
21+
assert "anomaly_score" in body

0 commit comments

Comments
 (0)