Spaces:
Sleeping
Sleeping
Update modules/testing.py
Browse files- modules/testing.py +29 -1
modules/testing.py
CHANGED
|
@@ -508,4 +508,32 @@ if __name__ == "__main__":
|
|
| 508 |
else:
|
| 509 |
sys.exit(0)
|
| 510 |
|
| 511 |
-
asyncio.run(main())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 508 |
else:
|
| 509 |
sys.exit(0)
|
| 510 |
|
| 511 |
+
asyncio.run(main())
|
| 512 |
+
# ==========================================
|
| 513 |
+
# REGISTER MODULE FUNCTION
|
| 514 |
+
# ==========================================
|
| 515 |
+
def register_module(app, client, username):
|
| 516 |
+
"""Register testing module with FastAPI app"""
|
| 517 |
+
from fastapi import APIRouter
|
| 518 |
+
|
| 519 |
+
router = APIRouter()
|
| 520 |
+
|
| 521 |
+
@router.get("/testing/status")
|
| 522 |
+
async def testing_status():
|
| 523 |
+
return {
|
| 524 |
+
"module": "testing",
|
| 525 |
+
"status": "ready",
|
| 526 |
+
"capabilities": ["automated_tests", "performance_testing", "endpoint_testing"]
|
| 527 |
+
}
|
| 528 |
+
|
| 529 |
+
@router.get("/testing/run")
|
| 530 |
+
async def run_tests():
|
| 531 |
+
from .testing import AumCoreTestRunner, run_automated_tests
|
| 532 |
+
try:
|
| 533 |
+
results = await run_automated_tests()
|
| 534 |
+
return {"success": True, "results": results}
|
| 535 |
+
except Exception as e:
|
| 536 |
+
return {"success": False, "error": str(e)}
|
| 537 |
+
|
| 538 |
+
app.include_router(router)
|
| 539 |
+
print("✅ Testing module registered with FastAPI")
|