|
|
@@ -1,5 +1,6 @@
|
|
|
from unittest import IsolatedAsyncioTestCase
|
|
|
from unittest.mock import AsyncMock, patch
|
|
|
+from uuid import uuid4
|
|
|
|
|
|
from custom_components.tuya_local.generic.climate import TuyaLocalClimate
|
|
|
from custom_components.tuya_local.generic.fan import TuyaLocalFan
|
|
|
@@ -37,6 +38,7 @@ class TuyaDeviceTestCase(IsolatedAsyncioTestCase):
|
|
|
self.conf_type = cfg.legacy_type
|
|
|
|
|
|
self.mock_device.name = cfg.name
|
|
|
+ self.mock_device.unique_id = str(uuid4())
|
|
|
|
|
|
self.entities = {}
|
|
|
self.entities[cfg.primary_entity.config_id] = self.create_entity(
|
|
|
@@ -74,9 +76,17 @@ class TuyaDeviceTestCase(IsolatedAsyncioTestCase):
|
|
|
for e in self.entities:
|
|
|
self.assertEqual(self.entities[e].friendly_name, self.names[e])
|
|
|
|
|
|
- def test_unique_id_returns_device_unique_id(self):
|
|
|
+ def test_unique_id_contains_device_unique_id(self):
|
|
|
+ entities = {}
|
|
|
for e in self.entities.values():
|
|
|
- self.assertEqual(e.unique_id, self.mock_device.unique_id)
|
|
|
+ self.assertIn(self.mock_device.unique_id, e.unique_id)
|
|
|
+ if type(e) not in entities:
|
|
|
+ entities[type(e)] = []
|
|
|
+
|
|
|
+ entities[type(e)].append(e.unique_id)
|
|
|
+
|
|
|
+ for e in entities.values():
|
|
|
+ self.assertCountEqual(e, set(e))
|
|
|
|
|
|
def test_device_info_returns_device_info_from_device(self):
|
|
|
for e in self.entities.values():
|