mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Make sure time is changed in mqtt event test (#100889)
This commit is contained in:
parent
9fe6cd61df
commit
a4f7f3ba7e
@ -706,10 +706,12 @@ async def test_skipped_async_ha_write_state(
|
|||||||
await help_test_skipped_async_ha_write_state(hass, topic, payload1, payload2)
|
await help_test_skipped_async_ha_write_state(hass, topic, payload1, payload2)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.freeze_time("2023-09-01 00:00:00+00:00")
|
||||||
@pytest.mark.parametrize("hass_config", [DEFAULT_CONFIG])
|
@pytest.mark.parametrize("hass_config", [DEFAULT_CONFIG])
|
||||||
async def test_skipped_async_ha_write_state2(
|
async def test_skipped_async_ha_write_state2(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||||
|
freezer: FrozenDateTimeFactory,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test a write state command is only called when there is a valid event."""
|
"""Test a write state command is only called when there is a valid event."""
|
||||||
await mqtt_mock_entry()
|
await mqtt_mock_entry()
|
||||||
@ -724,14 +726,17 @@ async def test_skipped_async_ha_write_state2(
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert len(mock_async_ha_write_state.mock_calls) == 1
|
assert len(mock_async_ha_write_state.mock_calls) == 1
|
||||||
|
|
||||||
|
freezer.move_to("2023-09-01 00:00:10+00:00")
|
||||||
async_fire_mqtt_message(hass, topic, payload1)
|
async_fire_mqtt_message(hass, topic, payload1)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert len(mock_async_ha_write_state.mock_calls) == 2
|
assert len(mock_async_ha_write_state.mock_calls) == 2
|
||||||
|
|
||||||
|
freezer.move_to("2023-09-01 00:00:20+00:00")
|
||||||
async_fire_mqtt_message(hass, topic, payload2)
|
async_fire_mqtt_message(hass, topic, payload2)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert len(mock_async_ha_write_state.mock_calls) == 2
|
assert len(mock_async_ha_write_state.mock_calls) == 2
|
||||||
|
|
||||||
|
freezer.move_to("2023-09-01 00:00:30+00:00")
|
||||||
async_fire_mqtt_message(hass, topic, payload2)
|
async_fire_mqtt_message(hass, topic, payload2)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert len(mock_async_ha_write_state.mock_calls) == 2
|
assert len(mock_async_ha_write_state.mock_calls) == 2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user