From f84f6aa713545cb8894d88b07ff2614c4bd570f1 Mon Sep 17 00:00:00 2001 From: cdnninja Date: Mon, 14 Apr 2025 05:58:54 -0600 Subject: [PATCH] Fix vesync purifier 131 tests (#142860) --- tests/components/vesync/common.py | 6 ++++- .../fixtures/air-purifier-131s-detail.json | 25 +++++++++++++++++++ .../vesync/fixtures/purifier-detail.json | 10 -------- .../components/vesync/snapshots/test_fan.ambr | 8 +++++- .../vesync/snapshots/test_sensor.ambr | 4 +-- 5 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 tests/components/vesync/fixtures/air-purifier-131s-detail.json delete mode 100644 tests/components/vesync/fixtures/purifier-detail.json diff --git a/tests/components/vesync/common.py b/tests/components/vesync/common.py index 39a92778727..18cb094563e 100644 --- a/tests/components/vesync/common.py +++ b/tests/components/vesync/common.py @@ -27,7 +27,11 @@ DEVICE_FIXTURES: dict[str, list[tuple[str, str, str]]] = { ("post", "/cloud/v2/deviceManaged/bypassV2", "device-detail.json") ], "Air Purifier 131s": [ - ("post", "/131airPurifier/v1/device/deviceDetail", "purifier-detail.json") + ( + "post", + "/131airPurifier/v1/device/deviceDetail", + "air-purifier-131s-detail.json", + ) ], "Air Purifier 200s": [ ("post", "/cloud/v2/deviceManaged/bypassV2", "device-detail.json") diff --git a/tests/components/vesync/fixtures/air-purifier-131s-detail.json b/tests/components/vesync/fixtures/air-purifier-131s-detail.json new file mode 100644 index 00000000000..a7598c621d3 --- /dev/null +++ b/tests/components/vesync/fixtures/air-purifier-131s-detail.json @@ -0,0 +1,25 @@ +{ + "code": 0, + "msg": "request success", + "traceId": "1744558015", + "screenStatus": "on", + "filterLife": { + "change": false, + "useHour": 3034, + "percent": 25 + }, + "activeTime": 0, + "timer": null, + "scheduleCount": 0, + "schedule": null, + "levelNew": 0, + "airQuality": "excellent", + "level": null, + "mode": "sleep", + "deviceName": "Levoit 131S Air Purifier", + "currentFirmVersion": "2.0.58", + "childLock": "off", + "deviceStatus": "on", + "deviceImg": "https://image.vesync.com/defaultImages/deviceDefaultImages/airpurifier131_240.png", + "connectionStatus": "online" +} diff --git a/tests/components/vesync/fixtures/purifier-detail.json b/tests/components/vesync/fixtures/purifier-detail.json deleted file mode 100644 index de0843975c3..00000000000 --- a/tests/components/vesync/fixtures/purifier-detail.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "code": 0, - "deviceStatus": "on", - "activeTime": 50, - "filterLife": 90, - "screenStatus": "on", - "mode": "auto", - "level": 2, - "airQuality": 95 -} diff --git a/tests/components/vesync/snapshots/test_fan.ambr b/tests/components/vesync/snapshots/test_fan.ambr index 0b56a08eeff..92473647a39 100644 --- a/tests/components/vesync/snapshots/test_fan.ambr +++ b/tests/components/vesync/snapshots/test_fan.ambr @@ -78,11 +78,17 @@ # name: test_fan_state[Air Purifier 131s][fan.air_purifier_131s] StateSnapshot({ 'attributes': ReadOnlyDict({ + 'active_time': 0, 'friendly_name': 'Air Purifier 131s', + 'mode': 'sleep', + 'percentage': None, + 'percentage_step': 33.333333333333336, + 'preset_mode': 'sleep', 'preset_modes': list([ 'auto', 'sleep', ]), + 'screen_status': 'on', 'supported_features': , }), 'context': , @@ -90,7 +96,7 @@ 'last_changed': , 'last_reported': , 'last_updated': , - 'state': 'unavailable', + 'state': 'on', }) # --- # name: test_fan_state[Air Purifier 200s][devices] diff --git a/tests/components/vesync/snapshots/test_sensor.ambr b/tests/components/vesync/snapshots/test_sensor.ambr index c701fa8a324..ecae8fa7674 100644 --- a/tests/components/vesync/snapshots/test_sensor.ambr +++ b/tests/components/vesync/snapshots/test_sensor.ambr @@ -114,7 +114,7 @@ 'last_changed': , 'last_reported': , 'last_updated': , - 'state': 'unavailable', + 'state': 'excellent', }) # --- # name: test_sensor_state[Air Purifier 131s][sensor.air_purifier_131s_filter_lifetime] @@ -129,7 +129,7 @@ 'last_changed': , 'last_reported': , 'last_updated': , - 'state': 'unavailable', + 'state': '25', }) # --- # name: test_sensor_state[Air Purifier 200s][devices]