-
Notifications
You must be signed in to change notification settings - Fork 10
Fix typos and move enum stage to avoid conflict #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,16 +10,10 @@ | |
|
|
||
| from pytfe.models.policy_evaluation import PolicyEvaluation | ||
| from pytfe.models.run import Run | ||
| from pytfe.models.run_task import Stage | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Importing Useful? React with 👍 / 👎. |
||
| from pytfe.models.task_result import TaskResult | ||
|
|
||
|
|
||
| class Stage(str, Enum): | ||
| pre_plan = "pre_plan" | ||
| post_plan = "post_plan" | ||
| pre_apply = "pre_apply" | ||
| post_apply = "post_apply" | ||
|
|
||
|
|
||
| class TaskStageStatus(str, Enum): | ||
| pending = "pending" | ||
| running = "running" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| """Unit tests for run task webhook request models.""" | ||
|
|
||
| from pytfe.models import RunTaskRequest, RunTaskRequestCapabilities | ||
|
|
||
|
|
||
| def _run_task_request_payload() -> dict: | ||
| return { | ||
| "access_token": "token", | ||
| "configuration_version_download_url": "https://example.com/cv", | ||
| "configuration_version_id": "cv-123", | ||
| "is_speculative": False, | ||
| "organization_name": "example-org", | ||
| "payload_version": 1, | ||
| "plan_json_api_url": "https://example.com/plan-json", | ||
| "run_app_url": "https://example.com/run", | ||
| "run_created_at": "2024-01-01T00:00:00Z", | ||
| "run_created_by": "user-123", | ||
| "run_id": "run-123", | ||
| "run_message": "Queued manually", | ||
| "stage": "post_plan", | ||
| "task_result_callback_url": "https://example.com/callback", | ||
| "task_result_enforcement_level": "mandatory", | ||
| "task_result_id": "taskrs-123", | ||
| "workspace_app_url": "https://example.com/workspace", | ||
| "workspace_id": "ws-123", | ||
| "workspace_name": "example-workspace", | ||
| } | ||
|
|
||
|
|
||
| def test_run_task_request_parses_capabilities_from_live_payload(): | ||
| payload = _run_task_request_payload() | ||
| payload["capabilities"] = {"outcomes": True} | ||
|
|
||
| request = RunTaskRequest.model_validate(payload) | ||
|
|
||
| assert isinstance(request.capabilities, RunTaskRequestCapabilities) | ||
| assert request.capabilities.outcomes is True | ||
| dumped = request.model_dump(by_alias=True) | ||
| assert dumped["capabilities"] == {"outcomes": True} | ||
| assert "capabilitites" not in dumped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the field/alias to
capabilitiesremoves support for the oldcapabilititesspelling with no fallback (validation_alias/alias choice), so persisted payloads or caller code built against earlier SDK versions will fail deserialization or attribute access after upgrade. For a typo fix in a stable SDK, this should remain backward-compatible (for at least one deprecation cycle) to avoid runtime breakage.Useful? React with 👍 / 👎.