Просмотр исходного кода

Kyvol vacuum: update tests for latest changes. Standardize naming.

- Standardize attribute names to be lower case with underscore between
words.  This is the format that Home Assistant UI expects.
- adapt tests to latest changes.

Fixes pytest issues with PR #269
Jason Rumney 3 лет назад
Родитель
Сommit
2c47d88f28

+ 5 - 5
custom_components/tuya_local/devices/kyvol_e30_vacuum.yaml

@@ -110,16 +110,16 @@ primary_entity:
           value: collision
     - id: 101
       type: string
-      name: WaterStatus
+      name: water_status
     - id: 102
       type: string
-      name: RobotModel
+      name: model
     - id: 104
       type: string
-      name: Mode
+      name: mode
     - id: 107
       type: integer
-      name: CarpetAdaptive
+      name: carpet_adaptive
 secondary_entities:
   - entity: sensor
     name: Clean time
@@ -138,7 +138,7 @@ secondary_entities:
       - id: 16
         type: integer
         name: sensor
-        unit: m2  
+        unit: m2
         mapping:
           - scale: 10
   - entity: switch

+ 1 - 0
tests/const.py

@@ -1031,6 +1031,7 @@ KYVOL_E30_VACUUM_PAYLOAD = {
     "12": False,
     "13": False,
     "14": "3",
+    "16": 0,
     "17": 0,
     "18": 0,
     "101": "2",

+ 13 - 4
tests/devices/test_kyvol_e30_vacuum.py

@@ -6,6 +6,7 @@ from homeassistant.components.vacuum import (
     VacuumEntityFeature,
 )
 from homeassistant.const import (
+    AREA_SQUARE_METERS,
     TIME_MINUTES,
     PERCENTAGE,
 )
@@ -30,12 +31,13 @@ RSTROLL_DPS = "11"
 RSTFILTER_DPS = "12"
 LOCATE_DPS = "13"
 FAN_DPS = "14"
+AREA_DPS = "16"
 TIME_DPS = "17"
 ERROR_DPS = "18"
-UNKNOWN101_DPS = "101"
-UNKNOWN102_DPS = "102"
-UNKNOWN104_DPS = "104"
-UNKNOWN106_DPS = "107"
+WATER_DPS = "101"
+MODEL_DPS = "102"
+MODE_DPS = "104"
+CARPET_DPS = "107"
 
 
 class TestKyvolE30Vacuum(MultiSensorTests, MultiSwitchTests, TuyaDeviceTestCase):
@@ -46,6 +48,12 @@ class TestKyvolE30Vacuum(MultiSensorTests, MultiSwitchTests, TuyaDeviceTestCase)
         self.subject = self.entities.get("vacuum")
         self.setUpMultiSensors(
             [
+                {
+                    "dps": AREA_DPS,
+                    "name": "sensor_clean_area",
+                    "unit": AREA_SQUARE_METERS,
+                    "testdata": (30, 3.0),
+                },
                 {
                     "dps": TIME_DPS,
                     "name": "sensor_clean_time",
@@ -90,6 +98,7 @@ class TestKyvolE30Vacuum(MultiSensorTests, MultiSwitchTests, TuyaDeviceTestCase)
         )
         self.mark_secondary(
             [
+                "sensor_clean_area",
                 "sensor_clean_time",
                 "sensor_edge_brush",
                 "sensor_roll_brush",