trygithubactions / tests /test_api.py
subashpoudel's picture
Debugged test cases of brainstorming
72194e7
raw
history blame
2.12 kB
from fastapi.testclient import TestClient
from api.main import app
client = TestClient(app)
def test_root():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"response":"Hello"}
def test_context_analysis():
payload = {
"message": "Hello"
}
response = client.post("/api/context-analysis", json=payload)
print(response.json())
assert response.status_code == 200
assert response.json()
def test_orchestrator():
payload = {
"message":"Mention some popular influencers of nepal"
}
response = client.post("/api/orchestration", json=payload)
print(response.json())
assert response.status_code == 200
def test_analytics():
response = client.post("/api/show-analytics", json={})
print(response.json())
assert response.status_code == 200
def test_ideation():
response = client.post("/api/ideation", json={})
print(response.json())
assert response.status_code == 200
def test_human_refining_ideation():
payload = {
"query": "Combine ideas 1 and 2",
"thread_id":"refine_ideas_thread"
}
response = client.post("/api/human-idea-refining", json=payload)
print(response.json())
assert response.status_code == 200
def test_brainstorming():
payload = {
"preferred_topics": [],
"image_base64_list": []
}
response = client.post("/api/brainstorm", json=payload)
print(response.json())
assert response.status_code == 200
def test_brainstorming_with_topics():
payload = {
"preferred_topics": ["fitness","community"],
"image_base64_list": []
}
response = client.post("/api/brainstorm", json=payload)
print(response.json())
assert response.status_code == 200
def test_final_story_generation():
response = client.post("/api/generate-final-story", json={})
print(response.json())
assert response.status_code == 200
def test_image_generation():
response = client.post("/api/generate-image", json={})
print(response.json())
assert response.status_code == 200