- Added new modules for advisor compliance, KYC sessions, and script templates, enhancing the advisor agent's capabilities. - Implemented a comprehensive API structure under the `/api/advisor-agent` prefix, ensuring clear organization and access to new features. - Established database models and repositories for compliance rules and KYC sessions, facilitating robust data management. - Integrated exception handling and response models to improve error management and user feedback. - Updated settings to include new configurations for compliance and KYC features, ensuring flexibility and adaptability. This update significantly expands the advisor agent's functionality, providing essential tools for compliance and customer interaction while maintaining a structured API design.
56 lines
2.2 KiB
Python
56 lines
2.2 KiB
Python
"""Rewrite advisor sprint tests for merger canonical paths."""
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2] / "tests"
|
|
|
|
SCHEMA_IMPORTS = (
|
|
"ComplianceCheckRequest",
|
|
"ComplianceRuleCreate",
|
|
"ComplianceRuleUpdate",
|
|
"ComplianceCheckResult",
|
|
"CopyTrackRequest",
|
|
"TemplateCreate",
|
|
"KycSessionCreate",
|
|
"KycChatRequest",
|
|
"MarketAlertScanRequest",
|
|
"GuardCheckRequest",
|
|
)
|
|
|
|
PATH_MAP = [
|
|
("/api/v1/compliance/check", "/api/advisor-agent/compliance/content-check"),
|
|
("/api/v1/compliance/ping", "/api/advisor-agent/compliance/ping"),
|
|
("/api/v1/compliance/rules", "/api/advisor-agent/compliance/rules"),
|
|
("/api/v1/templates/", "/api/advisor-agent/script-templates/"),
|
|
("/api/v1/templates", "/api/advisor-agent/script-templates"),
|
|
("/api/v1/market-alerts", "/api/advisor-agent/market-alerts"),
|
|
("/api/v1/market/", "/api/advisor-agent/market/"),
|
|
("/api/v1/kyc/", "/api/advisor-agent/kyc/"),
|
|
("/api/v1/kyc", "/api/advisor-agent/kyc"),
|
|
("/api/v1/copy/", "/api/advisor-agent/copy/"),
|
|
("/api/v1/guard/", "/api/advisor-agent/guard/"),
|
|
("/api/v1/allocation/", "/api/advisor-agent/allocation/"),
|
|
("/api/v1/dashboard/", "/api/advisor-agent/dashboard/"),
|
|
("/api/v1/admin/audit-logs", "/api/advisor-agent/admin/audit-logs"),
|
|
]
|
|
|
|
for path in ROOT.glob("test_sprint*.py"):
|
|
text = path.read_text(encoding="utf-8")
|
|
orig = text
|
|
for old, new in PATH_MAP:
|
|
text = text.replace(old, new)
|
|
text = text.replace("from app.model.schemas import", "from app.model.advisor_schemas import")
|
|
text = text.replace("from app.service.template_service import", "from app.service.script_template_service import")
|
|
text = text.replace("TemplateService", "ScriptTemplateService")
|
|
text = re.sub(
|
|
r'client\.post\(\s*"/api/v1/auth/login",\s*json=\{"username": "advisor_test", "password": "advisor_test"\},?\s*\)',
|
|
'client.post("/api/auth/login", json={"actor_id": "STAFF-10086", "token_type": "staff"})',
|
|
text,
|
|
)
|
|
text = text.replace('"access_token"', '"access_token"') # login response shape differs
|
|
if text != orig:
|
|
path.write_text(text, encoding="utf-8")
|
|
print("updated", path.name)
|