Test creating PackageRequest from dictionary.
(self)
| 55 | assert req_dict["request_id"] == "req_test_123" |
| 56 | |
| 57 | def test_from_dict(self): |
| 58 | """Test creating PackageRequest from dictionary.""" |
| 59 | data = { |
| 60 | "project_dir": "/path/to/project", |
| 61 | "environment": "esp32c6", |
| 62 | "timestamp": 1234567890.0, |
| 63 | "caller_pid": 12345, |
| 64 | "caller_cwd": "/path/to/cwd", |
| 65 | "request_id": "req_test_123", |
| 66 | } |
| 67 | |
| 68 | req = PackageRequest.from_dict(data) |
| 69 | |
| 70 | assert req.project_dir == "/path/to/project" |
| 71 | assert req.environment == "esp32c6" |
| 72 | assert req.timestamp == 1234567890.0 |
| 73 | assert req.caller_pid == 12345 |
| 74 | assert req.caller_cwd == "/path/to/cwd" |
| 75 | assert req.request_id == "req_test_123" |
| 76 | |
| 77 | def test_roundtrip(self): |
| 78 | """Test round-trip conversion: object -> dict -> object.""" |