(self)
| 302 | """Test ErrorMessage""" |
| 303 | |
| 304 | def test_from_code(self) -> None: |
| 305 | msg = ErrorMessage.from_code( |
| 306 | "req-789", |
| 307 | ErrorCode.INSTANCE_NOT_FOUND, |
| 308 | "Instance not found: /path/to/project", |
| 309 | ) |
| 310 | d = msg.to_dict() |
| 311 | |
| 312 | assert d["type"] == "ERROR" |
| 313 | assert d["id"] == "req-789" |
| 314 | assert d["success"] is False |
| 315 | assert d["error"]["code"] == "INSTANCE_NOT_FOUND" |
| 316 | assert d["error"]["message"] == "Instance not found: /path/to/project" |
| 317 | |
| 318 | |
| 319 | class TestInstancesMessage: |