-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
31 lines (22 loc) · 1017 Bytes
/
test.py
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
29
30
31
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)
def test_read_main():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"message": "Please send a request to /recommendSimilarArticles or /recommendOutfit"}
def test_recommend_similar_articles():
response = client.post("/recommendSimilarArticles", json={'product_id': 13795822, 'top_k': 10})
print(response.json())
assert response.status_code == 200
# TODO
def recommend_outfit():
response = client.post("/recommendOutfit", json={'product_id': 13784032, 'color_palette':'Complementary',
'recommend_bags': True, 'recommend_accessories': True,
'recommend_jewelry':True})
print(response.json())
assert response.status_code == 200
if __name__ == '__main__':
test_read_main()
test_recommend_similar_articles()
recommend_outfit()