Skip to content

Commit c72f6b7

Browse files
committed
Add testcase for the added Stretch
1 parent a9f44bf commit c72f6b7

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

tests/test_smile.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2885,6 +2885,47 @@ async def test_connect_timeout(self, timeout_test):
28852885
except pw_exceptions.DeviceTimeoutError:
28862886
assert True
28872887

2888+
# This test must be last as this one replaces the content of DOMAIN_OBJECTS by MODULES
2889+
@pytest.mark.asyncio
2890+
async def test_connect_stretch_v27_no_domain(self):
2891+
"""Test erroneous domain_objects file from user."""
2892+
# testdata dictionary with key ctrl_id_dev_id => keys:values
2893+
testdata = {
2894+
# 76BF93
2895+
"8b8d14b242e24cd789743c828b9a2ea9": {
2896+
"sensors": {"electricity_consumed": 1.69},
2897+
"switches": {"lock": False, "relay": True},
2898+
},
2899+
# 25F66AD
2900+
"d0122ac66eba47b99d8e5fbd1e2f5932": {
2901+
"sensors": {"electricity_consumed_interval": 2.21}
2902+
},
2903+
}
2904+
2905+
self.smile_setup = "stretch_v27_no_domain"
2906+
server, smile, client = await self.connect_wrapper(stretch=True)
2907+
assert smile.smile_hostname == "stretch000000"
2908+
2909+
_LOGGER.info("Basics:")
2910+
_LOGGER.info(" # Assert type = thermostat")
2911+
assert smile.smile_type == "stretch"
2912+
_LOGGER.info(" # Assert version")
2913+
assert smile.smile_version[0] == "2.7.18"
2914+
_LOGGER.info(" # Assert legacy")
2915+
assert smile._smile_legacy # pylint: disable=protected-access
2916+
2917+
await self.device_test(smile, testdata)
2918+
_LOGGER.info(" # Assert no master thermostat")
2919+
assert smile._sm_thermostat is None # it's not a thermostat :)
2920+
2921+
switch_change = await self.tinker_switch(
2922+
smile, "8b8d14b242e24cd789743c828b9a2ea9"
2923+
)
2924+
assert switch_change
2925+
2926+
await smile.close_connection()
2927+
await self.disconnect(server, client)
2928+
28882929
class PlugwiseTestError(Exception):
28892930
"""Plugwise test exceptions class."""
28902931

0 commit comments

Comments
 (0)