feat: implement v1 consumer API endpoints with runtime_id support (REQ-004~010)
- Generate runtime_id for service-token issuance (CLI and API)
- Implement GET /v1/assets endpoint with asset view and strategy_params
- Implement GET /v1/user_info endpoint with trading_enabled and broker credentials
- Implement POST /v1/assets/{asset_id}/ledger/trades with idempotency support
- Update auth service to support runtime_id tracking and credential encryption
- Add comprehensive test coverage for v1 endpoints (dcy-002 implementation)
- Update postgres repository for ledger and broker credential queries
- Ensure all tests pass for feature validation
This commit is contained in:
@@ -140,6 +140,22 @@ def test_issue_service_token_defaults_to_365_days() -> None:
|
||||
assert (result.auth_token.expires_at - datetime.now(timezone.utc)).days >= 364
|
||||
assert result.auth_token.token_type == "service"
|
||||
assert result.auth_token.name == "my-token"
|
||||
assert result.auth_token.runtime_id is not None
|
||||
|
||||
|
||||
def test_issue_service_token_generates_distinct_runtime_ids() -> None:
|
||||
from app.domain.models import User
|
||||
|
||||
repo = _AuthRepo()
|
||||
repo.users["alice"] = User(id="user-1", username="alice", permission="read")
|
||||
service = _service(repo)
|
||||
|
||||
first = service.issue_service_token("my-token-1", "alice")
|
||||
second = service.issue_service_token("my-token-2", "alice")
|
||||
|
||||
assert first.auth_token.runtime_id is not None
|
||||
assert second.auth_token.runtime_id is not None
|
||||
assert first.auth_token.runtime_id != second.auth_token.runtime_id
|
||||
|
||||
|
||||
def test_issue_service_token_no_expiry() -> None:
|
||||
|
||||
Reference in New Issue
Block a user