File size: 580 Bytes
7749774
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from fastapi.testclient import TestClient
import json

from server import app

client = TestClient(app)

def test_read_app():
    response = client.get("/")
    assert response.status_code == 200
    assert response.json() == {"status": "House Price Prediction"}

def test_predict_house_price():
	response = client.post(
			"/predict_house_price",
			json={
				'medInc': 8.3252,
				'houseAge': 41,
				'avgRooms': 6.0,
				'avgBdrms': 1.0,
				'population': 1.0,
				'avgOccup': 2.5,
				'latitude': 37.88,
				'longitude': -122.23,
			}
		)

	assert response.status_code == 200