2022-04-01 21:55:59 +02:00

33 lines
648 B
Python

import json
import pytest
from image_prediction.flask import make_prediction_server
@pytest.fixture
def server():
server = make_prediction_server(lambda _: 42)
server.config.update({"TESTING": True})
return server
@pytest.fixture
def client(server):
return server.test_client()
def test_server_predict(client):
response = client.post("/predict")
assert json.loads(response.data) == 42
def test_server_health_check(client):
response = client.get("/health")
assert response.status_code == 200
def test_server_ready_check(client):
response = client.get("/health")
assert response.status_code == 200