mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-12 21:47:23 -04:00
feat(api): add warnings field to response models
Add optional warnings field to: - SimulateTriggerResponse - JobStatusResponse Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -74,6 +74,7 @@ class SimulateTriggerResponse(BaseModel):
|
|||||||
deployment_mode: str
|
deployment_mode: str
|
||||||
is_dev_mode: bool
|
is_dev_mode: bool
|
||||||
preserve_dev_data: Optional[bool] = None
|
preserve_dev_data: Optional[bool] = None
|
||||||
|
warnings: Optional[List[str]] = None
|
||||||
|
|
||||||
|
|
||||||
class JobProgress(BaseModel):
|
class JobProgress(BaseModel):
|
||||||
@@ -100,6 +101,7 @@ class JobStatusResponse(BaseModel):
|
|||||||
deployment_mode: str
|
deployment_mode: str
|
||||||
is_dev_mode: bool
|
is_dev_mode: bool
|
||||||
preserve_dev_data: Optional[bool] = None
|
preserve_dev_data: Optional[bool] = None
|
||||||
|
warnings: Optional[List[str]] = None
|
||||||
|
|
||||||
|
|
||||||
class HealthResponse(BaseModel):
|
class HealthResponse(BaseModel):
|
||||||
|
|||||||
32
tests/unit/test_response_models.py
Normal file
32
tests/unit/test_response_models.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
from api.main import SimulateTriggerResponse, JobStatusResponse, JobProgress
|
||||||
|
|
||||||
|
def test_simulate_trigger_response_accepts_warnings():
|
||||||
|
"""Test SimulateTriggerResponse accepts warnings field."""
|
||||||
|
response = SimulateTriggerResponse(
|
||||||
|
job_id="test-123",
|
||||||
|
status="completed",
|
||||||
|
total_model_days=10,
|
||||||
|
message="Job completed",
|
||||||
|
deployment_mode="DEV",
|
||||||
|
is_dev_mode=True,
|
||||||
|
warnings=["Rate limited", "Skipped 2 dates"]
|
||||||
|
)
|
||||||
|
|
||||||
|
assert response.warnings == ["Rate limited", "Skipped 2 dates"]
|
||||||
|
|
||||||
|
def test_job_status_response_accepts_warnings():
|
||||||
|
"""Test JobStatusResponse accepts warnings field."""
|
||||||
|
response = JobStatusResponse(
|
||||||
|
job_id="test-123",
|
||||||
|
status="completed",
|
||||||
|
progress=JobProgress(total_model_days=10, completed=10, failed=0, pending=0),
|
||||||
|
date_range=["2025-10-01"],
|
||||||
|
models=["gpt-5"],
|
||||||
|
created_at="2025-11-01T00:00:00Z",
|
||||||
|
details=[],
|
||||||
|
deployment_mode="DEV",
|
||||||
|
is_dev_mode=True,
|
||||||
|
warnings=["Rate limited"]
|
||||||
|
)
|
||||||
|
|
||||||
|
assert response.warnings == ["Rate limited"]
|
||||||
Reference in New Issue
Block a user