Files
memory-gateway/tests/test_memory_system_server.py
tomtan 70cda923b2 Refactor OpenViking Memory API and User Management
- Updated API authentication headers to use `X-API-Key` for both admin and user APIs.
- Modified the account creation process to directly create user-specific accounts without requiring an admin workspace.
- Enhanced user creation to return account-specific details, including `admin_user_id`.
- Introduced new endpoints for retrieving task status and user profiles, allowing for more flexible user data management.
- Updated search functionality to include additional parameters such as `level` and `score_threshold`.
- Improved the handling of user keys in the storage layer to associate them with specific accounts.
- Added tests to validate the new user account creation process and search functionalities, ensuring proper integration with the OpenViking service.
- Included new documentation to reflect changes in API usage and expected request/response formats.
2026-05-27 16:09:28 +08:00

39 lines
1.5 KiB
Python

def test_memory_system_server_exposes_routes():
from memory_system_api.server import app
paths = {route.path for route in app.routes}
assert "/memory-system/users" in paths
assert "/memory-system/messages" in paths
assert "/memory-system/sessions/{session_id}/context" in paths
context_methods = {
method
for route in app.routes
if getattr(route, "path", "") == "/memory-system/sessions/{session_id}/context"
for method in getattr(route, "methods", set())
}
assert {"GET", "POST"} <= context_methods
assert "/memory-system/search" in paths
assert "/memory-system/users/{user_id}/profile" in paths
task_methods = {
method
for route in app.routes
if getattr(route, "path", "") == "/memory-system/openviking/tasks/{task_id}"
for method in getattr(route, "methods", set())
}
profile_methods = {
method
for route in app.routes
if getattr(route, "path", "") == "/memory-system/users/{user_id}/profile"
for method in getattr(route, "methods", set())
}
assert {"GET", "POST"} <= task_methods
assert {"GET", "POST"} <= profile_methods
def test_memory_system_messages_does_not_require_account_key_header():
from memory_system_api.server import app
route = next(route for route in app.routes if getattr(route, "path", "") == "/memory-system/messages")
assert all(getattr(dependency.call, "__name__", "") != "account_key_header" for dependency in route.dependant.dependencies)