Spaces:
Sleeping
Sleeping
Commit
·
4a45dbd
1
Parent(s):
503e05b
Standardized test codes
Browse files- tests/test_analytics.py +9 -0
- tests/test_api.py +0 -85
- tests/test_brainstorm.py +22 -0
- tests/test_context_analysis.py +14 -0
- tests/test_final_story.py +9 -0
- tests/test_human_idea_refinement.py +14 -0
- tests/test_ideation.py +9 -0
- tests/test_image_generation.py +9 -0
- tests/test_orchestrator.py +13 -0
- tests/test_root.py +34 -0
tests/test_analytics.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi.testclient import TestClient
|
| 2 |
+
from api.main import app
|
| 3 |
+
|
| 4 |
+
client = TestClient(app)
|
| 5 |
+
|
| 6 |
+
def test_analytics():
|
| 7 |
+
response = client.post("/api/show-analytics", json={})
|
| 8 |
+
print(response.json())
|
| 9 |
+
assert response.status_code == 200
|
tests/test_api.py
DELETED
|
@@ -1,85 +0,0 @@
|
|
| 1 |
-
from fastapi.testclient import TestClient
|
| 2 |
-
from api.main import app
|
| 3 |
-
|
| 4 |
-
client = TestClient(app)
|
| 5 |
-
|
| 6 |
-
def test_root():
|
| 7 |
-
response = client.get("/")
|
| 8 |
-
assert response.status_code == 200
|
| 9 |
-
assert response.json() == {"response":"Hello"}
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
def test_context_analysis():
|
| 13 |
-
payload = {
|
| 14 |
-
"message": "Hello"
|
| 15 |
-
}
|
| 16 |
-
|
| 17 |
-
response = client.post("/api/context-analysis", json=payload)
|
| 18 |
-
print(response.json())
|
| 19 |
-
assert response.status_code == 200
|
| 20 |
-
assert response.json()
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
def test_orchestrator():
|
| 24 |
-
payload = {
|
| 25 |
-
"message":"Mention some popular influencers of nepal"
|
| 26 |
-
}
|
| 27 |
-
response = client.post("/api/orchestration", json=payload)
|
| 28 |
-
print(response.json())
|
| 29 |
-
assert response.status_code == 200
|
| 30 |
-
|
| 31 |
-
def test_analytics():
|
| 32 |
-
response = client.post("/api/show-analytics", json={})
|
| 33 |
-
print(response.json())
|
| 34 |
-
assert response.status_code == 200
|
| 35 |
-
|
| 36 |
-
def test_ideation():
|
| 37 |
-
response = client.post("/api/ideation", json={})
|
| 38 |
-
print(response.json())
|
| 39 |
-
assert response.status_code == 200
|
| 40 |
-
|
| 41 |
-
def test_human_refining_ideation():
|
| 42 |
-
payload = {
|
| 43 |
-
"query": "Combine ideas 1 and 2",
|
| 44 |
-
"thread_id":"refine_ideas_thread"
|
| 45 |
-
}
|
| 46 |
-
response = client.post("/api/human-idea-refining", json=payload)
|
| 47 |
-
print(response.json())
|
| 48 |
-
assert response.status_code == 200
|
| 49 |
-
|
| 50 |
-
def test_brainstorming():
|
| 51 |
-
payload = {
|
| 52 |
-
"preferred_topics": [],
|
| 53 |
-
"image_base64_list": []
|
| 54 |
-
}
|
| 55 |
-
response = client.post("/api/brainstorm", json=payload)
|
| 56 |
-
print(response.json())
|
| 57 |
-
assert response.status_code == 200
|
| 58 |
-
|
| 59 |
-
def test_brainstorming_with_topics():
|
| 60 |
-
payload = {
|
| 61 |
-
"preferred_topics": ["fitness","community"],
|
| 62 |
-
"image_base64_list": []
|
| 63 |
-
}
|
| 64 |
-
response = client.post("/api/brainstorm", json=payload)
|
| 65 |
-
print(response.json())
|
| 66 |
-
assert response.status_code == 200
|
| 67 |
-
|
| 68 |
-
def test_final_story_generation():
|
| 69 |
-
response = client.post("/api/generate-final-story", json={})
|
| 70 |
-
print(response.json())
|
| 71 |
-
assert response.status_code == 200
|
| 72 |
-
|
| 73 |
-
def test_image_generation():
|
| 74 |
-
response = client.post("/api/generate-image", json={})
|
| 75 |
-
print(response.json())
|
| 76 |
-
assert response.status_code == 200
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tests/test_brainstorm.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi.testclient import TestClient
|
| 2 |
+
from api.main import app
|
| 3 |
+
|
| 4 |
+
client = TestClient(app)
|
| 5 |
+
|
| 6 |
+
def test_brainstorming():
|
| 7 |
+
payload = {
|
| 8 |
+
"preferred_topics": [],
|
| 9 |
+
"image_base64_list": []
|
| 10 |
+
}
|
| 11 |
+
response = client.post("/api/brainstorm", json=payload)
|
| 12 |
+
print(response.json())
|
| 13 |
+
assert response.status_code == 200
|
| 14 |
+
|
| 15 |
+
def test_brainstorming_with_topics():
|
| 16 |
+
payload = {
|
| 17 |
+
"preferred_topics": ["fitness","community"],
|
| 18 |
+
"image_base64_list": []
|
| 19 |
+
}
|
| 20 |
+
response = client.post("/api/brainstorm", json=payload)
|
| 21 |
+
print(response.json())
|
| 22 |
+
assert response.status_code == 200
|
tests/test_context_analysis.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi.testclient import TestClient
|
| 2 |
+
from api.main import app
|
| 3 |
+
|
| 4 |
+
client = TestClient(app)
|
| 5 |
+
|
| 6 |
+
def test_context_analysis():
|
| 7 |
+
payload = {
|
| 8 |
+
"message": "Hello"
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
response = client.post("/api/context-analysis", json=payload)
|
| 12 |
+
print(response.json())
|
| 13 |
+
assert response.status_code == 200
|
| 14 |
+
assert response.json()
|
tests/test_final_story.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi.testclient import TestClient
|
| 2 |
+
from api.main import app
|
| 3 |
+
|
| 4 |
+
client = TestClient(app)
|
| 5 |
+
|
| 6 |
+
def test_final_story_generation():
|
| 7 |
+
response = client.post("/api/generate-final-story", json={})
|
| 8 |
+
print(response.json())
|
| 9 |
+
assert response.status_code == 200
|
tests/test_human_idea_refinement.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi.testclient import TestClient
|
| 2 |
+
from api.main import app
|
| 3 |
+
|
| 4 |
+
client = TestClient(app)
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def test_human_refining_ideation():
|
| 8 |
+
payload = {
|
| 9 |
+
"query": "Combine ideas 1 and 2",
|
| 10 |
+
"thread_id":"refine_ideas_thread"
|
| 11 |
+
}
|
| 12 |
+
response = client.post("/api/human-idea-refining", json=payload)
|
| 13 |
+
print(response.json())
|
| 14 |
+
assert response.status_code == 200
|
tests/test_ideation.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi.testclient import TestClient
|
| 2 |
+
from api.main import app
|
| 3 |
+
|
| 4 |
+
client = TestClient(app)
|
| 5 |
+
|
| 6 |
+
def test_ideation():
|
| 7 |
+
response = client.post("/api/ideation", json={})
|
| 8 |
+
print(response.json())
|
| 9 |
+
assert response.status_code == 200
|
tests/test_image_generation.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi.testclient import TestClient
|
| 2 |
+
from api.main import app
|
| 3 |
+
|
| 4 |
+
client = TestClient(app)
|
| 5 |
+
|
| 6 |
+
def test_image_generation():
|
| 7 |
+
response = client.post("/api/generate-image", json={})
|
| 8 |
+
print(response.json())
|
| 9 |
+
assert response.status_code == 200
|
tests/test_orchestrator.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi.testclient import TestClient
|
| 2 |
+
from api.main import app
|
| 3 |
+
|
| 4 |
+
client = TestClient(app)
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def test_orchestrator():
|
| 8 |
+
payload = {
|
| 9 |
+
"message":"Mention some popular influencers of nepal"
|
| 10 |
+
}
|
| 11 |
+
response = client.post("/api/orchestration", json=payload)
|
| 12 |
+
print(response.json())
|
| 13 |
+
assert response.status_code == 200
|
tests/test_root.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi.testclient import TestClient
|
| 2 |
+
from api.main import app
|
| 3 |
+
|
| 4 |
+
client = TestClient(app)
|
| 5 |
+
|
| 6 |
+
def test_root():
|
| 7 |
+
response = client.get("/")
|
| 8 |
+
assert response.status_code == 200
|
| 9 |
+
assert response.json() == {"response":"Hello"}
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
|