Spaces:
Building
Building
Update test_controller.py
Browse files- test_controller.py +17 -8
test_controller.py
CHANGED
@@ -1,11 +1,20 @@
|
|
1 |
-
from fastapi import APIRouter
|
2 |
-
from
|
|
|
3 |
|
4 |
router = APIRouter()
|
5 |
|
6 |
-
@router.
|
7 |
-
def run_all_tests():
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import APIRouter, Depends
|
2 |
+
from app import get_config, ServiceConfig
|
3 |
+
import random
|
4 |
|
5 |
router = APIRouter()
|
6 |
|
7 |
+
@router.get("/run_all")
|
8 |
+
def run_all_tests(config: ServiceConfig = Depends(get_config)):
|
9 |
+
# Mock test results
|
10 |
+
test_results = []
|
11 |
+
for project_name in config.projects.keys():
|
12 |
+
result = {
|
13 |
+
"project": project_name,
|
14 |
+
"status": random.choice(["passed", "failed"]),
|
15 |
+
"details": f"Mock test for {project_name}"
|
16 |
+
}
|
17 |
+
test_results.append(result)
|
18 |
+
|
19 |
+
return {"results": test_results}
|
20 |
+
|