|
1 | 1 | from types import SimpleNamespace |
2 | | -from typing import Any |
| 2 | +from typing import Any, cast |
3 | 3 |
|
4 | 4 | from prime_cli.api.deployments import DeploymentsClient |
5 | 5 | from prime_cli.client import APIError |
@@ -98,7 +98,7 @@ def post(self, endpoint: str, json: dict[str, Any] | None = None) -> dict: |
98 | 98 | captured["json"] = json |
99 | 99 | return _adapter_response() |
100 | 100 |
|
101 | | - adapter = DeploymentsClient(DummyAPIClient()).deploy_checkpoint("ckpt-123") |
| 101 | + adapter = DeploymentsClient(cast(Any, DummyAPIClient())).deploy_checkpoint("ckpt-123") |
102 | 102 |
|
103 | 103 | assert captured["endpoint"] == "/rft/checkpoints/ckpt-123/deploy" |
104 | 104 | assert captured["json"] is None |
@@ -145,6 +145,20 @@ def deploy_checkpoint(self, checkpoint_id: str) -> Any: |
145 | 145 | assert "prime deployments list" in output |
146 | 146 |
|
147 | 147 |
|
| 148 | +def test_deployments_create_checkpoint_rejects_empty_checkpoint_id(monkeypatch) -> None: |
| 149 | + monkeypatch.setattr("prime_cli.main.check_for_update", lambda: (False, None)) |
| 150 | + |
| 151 | + result = runner.invoke( |
| 152 | + app, |
| 153 | + ["deployments", "create", "--checkpoint-id", "", "--yes"], |
| 154 | + env=TEST_ENV, |
| 155 | + ) |
| 156 | + output = strip_ansi(result.output) |
| 157 | + |
| 158 | + assert result.exit_code == 1 |
| 159 | + assert "Error: --checkpoint-id cannot be empty." in output |
| 160 | + |
| 161 | + |
148 | 162 | def test_deployments_create_checkpoint_surfaces_conflict_errors(monkeypatch) -> None: |
149 | 163 | monkeypatch.setattr("prime_cli.main.check_for_update", lambda: (False, None)) |
150 | 164 |
|
|
0 commit comments