Skip to content

Commit 74b414a

Browse files
committed
Improve testing-order, remove incorrect comment
1 parent c72f6b7 commit 74b414a

File tree

1 file changed

+40
-41
lines changed

1 file changed

+40
-41
lines changed

tests/test_smile.py

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2789,6 +2789,46 @@ async def test_connect_stretch_v23(self):
27892789
await smile.close_connection()
27902790
await self.disconnect(server, client)
27912791

2792+
@pytest.mark.asyncio
2793+
async def test_connect_stretch_v27_no_domain(self):
2794+
"""Test erroneous domain_objects file from user."""
2795+
# testdata dictionary with key ctrl_id_dev_id => keys:values
2796+
testdata = {
2797+
# 76BF93
2798+
"8b8d14b242e24cd789743c828b9a2ea9": {
2799+
"sensors": {"electricity_consumed": 1.69},
2800+
"switches": {"lock": False, "relay": True},
2801+
},
2802+
# 25F66AD
2803+
"d0122ac66eba47b99d8e5fbd1e2f5932": {
2804+
"sensors": {"electricity_consumed_interval": 2.21}
2805+
},
2806+
}
2807+
2808+
self.smile_setup = "stretch_v27_no_domain"
2809+
server, smile, client = await self.connect_wrapper(stretch=True)
2810+
assert smile.smile_hostname == "stretch000000"
2811+
2812+
_LOGGER.info("Basics:")
2813+
_LOGGER.info(" # Assert type = thermostat")
2814+
assert smile.smile_type == "stretch"
2815+
_LOGGER.info(" # Assert version")
2816+
assert smile.smile_version[0] == "2.7.18"
2817+
_LOGGER.info(" # Assert legacy")
2818+
assert smile._smile_legacy # pylint: disable=protected-access
2819+
2820+
await self.device_test(smile, testdata)
2821+
_LOGGER.info(" # Assert no master thermostat")
2822+
assert smile._sm_thermostat is None # it's not a thermostat :)
2823+
2824+
switch_change = await self.tinker_switch(
2825+
smile, "8b8d14b242e24cd789743c828b9a2ea9"
2826+
)
2827+
assert switch_change
2828+
2829+
await smile.close_connection()
2830+
await self.disconnect(server, client)
2831+
27922832
@pytest.mark.asyncio
27932833
async def test_connect_p1v4(self):
27942834
"""Test a P1 firmware 4 setup."""
@@ -2885,47 +2925,6 @@ async def test_connect_timeout(self, timeout_test):
28852925
except pw_exceptions.DeviceTimeoutError:
28862926
assert True
28872927

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-
29292928
class PlugwiseTestError(Exception):
29302929
"""Plugwise test exceptions class."""
29312930

0 commit comments

Comments
 (0)