Code: Select all
from fastapi.testclient import TestClient
from src.main import app
import json
client = TestClient(app)
def test_get_confidence_ws():
data = {
"acc_id": 1234567801,
"remoteIp": "127.255.255.255",
"userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0"
}
response = client.post("/confidence", json=json.dumps(data))
assert response.status_code == 200
< /code>
Testantwort < /p>
> assert response.status_code == 200
E assert 307 == 200
E + where 307 = .status_code
< /code>
Bearbeiten: < /p>
Der tatsächliche Endpunkt, der getestet wird: < /p>
@app.post("/confidence/")
def get_confidence(json: LoginClassifierSchema):
...
response = {
"key" : "value"
}
return response