Diff of /tests/test_api.py [000000] .. [0241e6]

Switch to unified view

a b/tests/test_api.py
1
import pytest
2
import sys
3
import os
4
5
# Add the 'api' directory to sys.path so that Python can find the app module
6
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../api')))
7
8
from app import create_app
9
10
@pytest.fixture
11
def client():
12
    app = create_app()
13
    with app.test_client() as client:
14
        yield client
15
16
# Test api function
17
def test_model_prediction(client):
18
    data = {"gender": 1, "age": 43, "smoking": 2, "yellow_skin": 2, "fatigue": 2, "wheezing": 2, "coughing": 2, "shortness_of_breath": 2, "swallowing_difficulty": 2, "chest_pain": 2, "chronic_disease": 1}
19
    
20
    response = client.post('/api/v1/predict', json=data)
21
    assert response.json["prediction"] == 1