|
10 | 10 | ) |
11 | 11 | from roborock.devices.device import RoborockDevice |
12 | 12 | from roborock.devices.traits.v1.wash_towel_mode import WashTowelModeTrait |
| 13 | +from roborock.exceptions import RoborockUnsupportedFeature |
13 | 14 | from roborock.roborock_typing import RoborockCommand |
14 | 15 | from tests.devices.traits.v1.helpers import dock_types_with_capability |
15 | 16 |
|
@@ -83,6 +84,8 @@ async def test_set_wash_towel_mode( |
83 | 84 | ) -> None: |
84 | 85 | """Test setting the wash towel mode.""" |
85 | 86 | assert wash_towel_mode is not None |
| 87 | + # Offer the smart mode, as on the Saros 10R |
| 88 | + wash_towel_mode.device_feature_trait.is_dirty_replenish_clean_supported = True |
86 | 89 |
|
87 | 90 | await wash_towel_mode.set_wash_towel_mode(wash_mode) |
88 | 91 |
|
@@ -189,3 +192,59 @@ async def test_wash_towel_mode_options( |
189 | 192 | wash_towel_mode.device_feature_trait.is_dirty_replenish_clean_supported = is_dirty_replenish_clean_supported |
190 | 193 |
|
191 | 194 | assert wash_towel_mode.wash_towel_mode_options == expected_modes |
| 195 | + |
| 196 | + |
| 197 | +@pytest.mark.parametrize( |
| 198 | + ("dock_type_code"), |
| 199 | + [(RoborockDockTypeCode.o4_dock)], |
| 200 | +) |
| 201 | +async def test_set_wash_towel_mode_rejects_unoffered( |
| 202 | + wash_towel_mode: WashTowelModeTrait, |
| 203 | + mock_rpc_channel: AsyncMock, |
| 204 | + dock_type_code: RoborockDockTypeCode, |
| 205 | +) -> None: |
| 206 | + """Test that a wash mode the device does not offer is rejected without sending.""" |
| 207 | + assert wash_towel_mode is not None |
| 208 | + wash_towel_mode.device_feature_trait.is_super_deep_wash_supported = True |
| 209 | + wash_towel_mode.device_feature_trait.is_dirty_replenish_clean_supported = True |
| 210 | + assert WashTowelModes.SUPER_DEEP not in wash_towel_mode.wash_towel_mode_options |
| 211 | + |
| 212 | + with pytest.raises(RoborockUnsupportedFeature): |
| 213 | + await wash_towel_mode.set_wash_towel_mode(WashTowelModes.SUPER_DEEP) |
| 214 | + |
| 215 | + mock_rpc_channel.send_command.assert_not_called() |
| 216 | + |
| 217 | + |
| 218 | +@pytest.mark.parametrize( |
| 219 | + ("dock_type_code"), |
| 220 | + [(RoborockDockTypeCode.shell_3s_dock)], |
| 221 | +) |
| 222 | +async def test_self_clean_tray( |
| 223 | + wash_towel_mode: WashTowelModeTrait, |
| 224 | + mock_rpc_channel: AsyncMock, |
| 225 | + dock_type_code: RoborockDockTypeCode, |
| 226 | +) -> None: |
| 227 | + """Test starting the wash tray self-clean on a dock with the carousel.""" |
| 228 | + assert wash_towel_mode is not None |
| 229 | + |
| 230 | + await wash_towel_mode.self_clean_tray() |
| 231 | + |
| 232 | + mock_rpc_channel.send_command.assert_called_once_with(RoborockCommand.APP_AMETHYST_SELF_CHECK) |
| 233 | + |
| 234 | + |
| 235 | +@pytest.mark.parametrize( |
| 236 | + ("dock_type_code"), |
| 237 | + [(RoborockDockTypeCode.o4_dock)], |
| 238 | +) |
| 239 | +async def test_self_clean_tray_unsupported( |
| 240 | + wash_towel_mode: WashTowelModeTrait, |
| 241 | + mock_rpc_channel: AsyncMock, |
| 242 | + dock_type_code: RoborockDockTypeCode, |
| 243 | +) -> None: |
| 244 | + """Test that the tray self-clean is rejected without sending on a dock without the carousel.""" |
| 245 | + assert wash_towel_mode is not None |
| 246 | + |
| 247 | + with pytest.raises(RoborockUnsupportedFeature): |
| 248 | + await wash_towel_mode.self_clean_tray() |
| 249 | + |
| 250 | + mock_rpc_channel.send_command.assert_not_called() |
0 commit comments