Test creating DaemonStatus from dictionary.
(self)
| 161 | assert status_dict["installation_in_progress"] is False |
| 162 | |
| 163 | def test_from_dict(self): |
| 164 | """Test creating DaemonStatus from dictionary.""" |
| 165 | data = { |
| 166 | "state": "installing", |
| 167 | "message": "Installing packages", |
| 168 | "updated_at": 1234567890.0, |
| 169 | "installation_in_progress": True, |
| 170 | "daemon_pid": 9999, |
| 171 | "caller_pid": 12345, |
| 172 | "current_operation": "Downloading toolchain", |
| 173 | } |
| 174 | |
| 175 | status = DaemonStatus.from_dict(data) |
| 176 | |
| 177 | assert status.state == DaemonState.INSTALLING |
| 178 | assert status.message == "Installing packages" |
| 179 | assert status.updated_at == 1234567890.0 |
| 180 | assert status.installation_in_progress is True |
| 181 | assert status.daemon_pid == 9999 |
| 182 | assert status.caller_pid == 12345 |
| 183 | assert status.current_operation == "Downloading toolchain" |
| 184 | |
| 185 | def test_roundtrip(self): |
| 186 | """Test round-trip conversion: object -> dict -> object.""" |