feat: Add intelligent auto-router and enhanced integrations
- Add intelligent-router.sh hook for automatic agent routing - Add AUTO-TRIGGER-SUMMARY.md documentation - Add FINAL-INTEGRATION-SUMMARY.md documentation - Complete Prometheus integration (6 commands + 4 tools) - Complete Dexto integration (12 commands + 5 tools) - Enhanced Ralph with access to all agents - Fix /clawd command (removed disable-model-invocation) - Update hooks.json to v5 with intelligent routing - 291 total skills now available - All 21 commands with automatic routing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
94
prometheus/tests/app/api/test_invitation_code.py
Normal file
94
prometheus/tests/app/api/test_invitation_code.py
Normal file
@@ -0,0 +1,94 @@
|
||||
import datetime
|
||||
from unittest import mock
|
||||
from unittest.mock import AsyncMock
|
||||
|
||||
import pytest
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from prometheus.app.api.routes import invitation_code
|
||||
from prometheus.app.entity.invitation_code import InvitationCode
|
||||
from prometheus.app.exception_handler import register_exception_handlers
|
||||
|
||||
app = FastAPI()
|
||||
register_exception_handlers(app)
|
||||
app.include_router(invitation_code.router, prefix="/invitation-code", tags=["invitation_code"])
|
||||
|
||||
|
||||
@app.middleware("mock_jwt_middleware")
|
||||
async def add_user_id(request: Request, call_next):
|
||||
request.state.user_id = 1 # Set user_id to 1 for testing purposes
|
||||
response = await call_next(request)
|
||||
return response
|
||||
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_service():
|
||||
service = mock.MagicMock()
|
||||
app.state.service = service
|
||||
yield service
|
||||
|
||||
|
||||
def test_create_invitation_code(mock_service):
|
||||
# Mock the return value of create_invitation_code
|
||||
mock_service["invitation_code_service"].create_invitation_code = AsyncMock(
|
||||
return_value=InvitationCode(
|
||||
id=1,
|
||||
code="testcode",
|
||||
is_used=False,
|
||||
expiration_time=datetime.datetime(
|
||||
year=2025, month=1, day=1, hour=0, minute=0, second=0
|
||||
),
|
||||
)
|
||||
)
|
||||
mock_service["user_service"].is_admin = AsyncMock(return_value=True)
|
||||
|
||||
# Test the creation endpoint
|
||||
response = client.post("invitation-code/create/")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"data": {
|
||||
"id": 1,
|
||||
"code": "testcode",
|
||||
"is_used": False,
|
||||
"expiration_time": "2025-01-01T00:00:00",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def test_list(mock_service):
|
||||
# Mock user as admin and return a list of invitation codes
|
||||
mock_service["invitation_code_service"].list_invitation_codes = AsyncMock(
|
||||
return_value=[
|
||||
InvitationCode(
|
||||
id=1,
|
||||
code="testcode",
|
||||
is_used=False,
|
||||
expiration_time=datetime.datetime(
|
||||
year=2025, month=1, day=1, hour=0, minute=0, second=0
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
mock_service["user_service"].is_admin = AsyncMock(return_value=True)
|
||||
|
||||
# Test the list endpoint
|
||||
response = client.get("invitation-code/list/")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"data": [
|
||||
{
|
||||
"id": 1,
|
||||
"code": "testcode",
|
||||
"is_used": False,
|
||||
"expiration_time": "2025-01-01T00:00:00",
|
||||
}
|
||||
],
|
||||
}
|
||||
Reference in New Issue
Block a user