Spaces:
Sleeping
Sleeping
Update modules/testing.py
Browse files- modules/testing.py +30 -29
modules/testing.py
CHANGED
|
@@ -467,6 +467,35 @@ async def run_automated_tests(base_url: str = None) -> Dict:
|
|
| 467 |
runner = AumCoreTestRunner(base_url)
|
| 468 |
return await runner.run_full_test_suite()
|
| 469 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 470 |
# Command line interface
|
| 471 |
if __name__ == "__main__":
|
| 472 |
import sys
|
|
@@ -508,32 +537,4 @@ if __name__ == "__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 |
-
# FIXED: Direct call without circular import
|
| 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")
|
|
|
|
| 467 |
runner = AumCoreTestRunner(base_url)
|
| 468 |
return await runner.run_full_test_suite()
|
| 469 |
|
| 470 |
+
# ==========================================
|
| 471 |
+
# REGISTER MODULE FUNCTION - FIXED VERSION
|
| 472 |
+
# ==========================================
|
| 473 |
+
def register_module(app, client, username):
|
| 474 |
+
"""Register testing module with FastAPI app"""
|
| 475 |
+
from fastapi import APIRouter
|
| 476 |
+
|
| 477 |
+
router = APIRouter(prefix="/system")
|
| 478 |
+
|
| 479 |
+
@router.get("/tests/status")
|
| 480 |
+
async def testing_status():
|
| 481 |
+
return {
|
| 482 |
+
"module": "testing",
|
| 483 |
+
"status": "ready",
|
| 484 |
+
"capabilities": ["automated_tests", "performance_testing", "endpoint_testing"]
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
@router.get("/tests/run")
|
| 488 |
+
async def run_tests():
|
| 489 |
+
try:
|
| 490 |
+
results = await run_automated_tests()
|
| 491 |
+
return {"success": True, "results": results}
|
| 492 |
+
except Exception as e:
|
| 493 |
+
return {"success": False, "error": str(e)}
|
| 494 |
+
|
| 495 |
+
app.include_router(router)
|
| 496 |
+
print("✅ Testing module registered with FastAPI")
|
| 497 |
+
return {"status": "registered"}
|
| 498 |
+
|
| 499 |
# Command line interface
|
| 500 |
if __name__ == "__main__":
|
| 501 |
import sys
|
|
|
|
| 537 |
else:
|
| 538 |
sys.exit(0)
|
| 539 |
|
| 540 |
+
asyncio.run(main())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|