Skip to content

Commit 48ca63c

Browse files
committed
Test rate limit on schedule selection
* tests/test_init.py:
1 parent 0acd562 commit 48ca63c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_init.py

+20
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,26 @@ async def test_climate(
11841184
assert responses.calls[32].request.body == '{"value": "windNice", "path": "/operationModes/cooling/fanDirection/vertical/currentMode"}'
11851185
assert hass.states.get("climate.werkkamer_room_temperature").attributes["swing_mode"] == "windnice"
11861186

1187+
responses.put(
1188+
DAIKIN_API_URL
1189+
+ "/v1/gateway-devices/1ece521b-5401-4a42-acce-6f76fba246aa/management-points/climateControlMainZone/schedule/cooling/current",
1190+
status=429,
1191+
headers={"X-RateLimit-Limit-minute": "0", "X-RateLimit-Limit-day": "0"},
1192+
)
1193+
# Set the device with schedule 'User defined' enabled, this should fail due to the rate limit
1194+
await hass.services.async_call(
1195+
SELECT_DOMAIN,
1196+
SERVICE_SELECT_OPTION,
1197+
{ATTR_ENTITY_ID: "select.altherma_climatecontrol_schedule", ATTR_OPTION: "User defined"},
1198+
blocking=True,
1199+
)
1200+
await hass.async_block_till_done()
1201+
1202+
assert len(responses.calls) == 34
1203+
assert responses.calls[33].request.body == '{"scheduleId": "scheduleCoolingRT1", "enabled": true}'
1204+
assert hass.states.get("select.altherma_climatecontrol_schedule").state == SCHEDULE_OFF
1205+
1206+
11871207

11881208
async def test_minimal_data(
11891209
hass: HomeAssistant,

0 commit comments

Comments
 (0)