Skip to content

Commit e46b492

Browse files
committed
Add testcase covering provided wrong input to smile.set_temperature()
1 parent f26193c commit e46b492

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

tests/test_smile.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,11 @@ async def tinker_switch(
486486
return tinker_switch_passed
487487

488488
@pytest.mark.asyncio
489-
async def tinker_thermostat_temp(self, smile, loc_id, unhappy=False):
489+
async def tinker_thermostat_temp(self, smile, loc_id, special=True, unhappy=False):
490490
"""Toggle temperature to test functionality."""
491491
_LOGGER.info("Asserting modifying settings in location (%s):", loc_id)
492492
test_temp = {"setpoint": 22.9}
493-
if smile._cooling_present:
493+
if smile._cooling_present and special:
494494
test_temp = {"setpoint_low": 19.5, "setpoint_high": 23.5}
495495
_LOGGER.info("- Adjusting temperature to %s", test_temp)
496496
try:
@@ -584,13 +584,14 @@ async def tinker_thermostat(
584584
schedule_on=True,
585585
good_schedules=None,
586586
single=False,
587+
special=True,
587588
unhappy=False,
588589
):
589590
"""Toggle various climate settings to test functionality."""
590591
if good_schedules is None: # pragma: no cover
591592
good_schedules = ["Weekschema"]
592593

593-
result_1 = await self.tinker_thermostat_temp(smile, loc_id, unhappy)
594+
result_1 = await self.tinker_thermostat_temp(smile, loc_id, special, unhappy)
594595
result_2 = await self.tinker_thermostat_preset(smile, loc_id, unhappy)
595596
if smile._schedule_old_states != {}:
596597
for item in smile._schedule_old_states[loc_id]:
@@ -4385,6 +4386,13 @@ async def test_connect_anna_loria_heating_idle(self):
43854386
],
43864387
)
43874388

4389+
with pytest.raises(pw_exceptions.PlugwiseError):
4390+
await self.tinker_thermostat_temp(
4391+
smile,
4392+
"15da035090b847e7a21f93e08c015ebc",
4393+
special=False,
4394+
)
4395+
43884396
await self.tinker_dhw_mode(smile)
43894397

43904398
await smile.close_connection()

0 commit comments

Comments
 (0)