Always include old_state in EventStateChangedData [tests] (#115098)
This commit is contained in:
parent
017b2fe685
commit
a52a80f806
2 changed files with 7 additions and 7 deletions
|
@ -589,12 +589,12 @@ def json_round_trip(obj: Any) -> Any:
|
|||
def mock_state_change_event(
|
||||
hass: HomeAssistant, new_state: State, old_state: State | None = None
|
||||
) -> None:
|
||||
"""Mock state change envent."""
|
||||
event_data = {"entity_id": new_state.entity_id, "new_state": new_state}
|
||||
|
||||
if old_state:
|
||||
event_data["old_state"] = old_state
|
||||
|
||||
"""Mock state change event."""
|
||||
event_data = {
|
||||
"entity_id": new_state.entity_id,
|
||||
"new_state": new_state,
|
||||
"old_state": old_state,
|
||||
}
|
||||
hass.bus.fire(EVENT_STATE_CHANGED, event_data, context=new_state.context)
|
||||
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ async def test_state_changed_event_sends_message(
|
|||
"last_updated": now.isoformat(),
|
||||
"state": "on",
|
||||
}
|
||||
event["event_data"] = {"new_state": new_state, "entity_id": e_id}
|
||||
event["event_data"] = {"new_state": new_state, "entity_id": e_id, "old_state": None}
|
||||
|
||||
# Verify that the message received was that expected
|
||||
result = json.loads(msg)
|
||||
|
|
Loading…
Add table
Reference in a new issue