Fix flakey tessie media_player test (#115391)

This commit is contained in:
J. Nick Koston 2024-04-10 14:18:11 -10:00 committed by GitHub
parent be8adf9d29
commit e17c4ab4e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View file

@ -54,6 +54,13 @@
'attributes': ReadOnlyDict({
'device_class': 'speaker',
'friendly_name': 'Test Media player',
'media_album_name': 'Album',
'media_artist': 'Artist',
'media_duration': 60.0,
'media_playlist': 'Playlist',
'media_position': 30.0,
'media_title': 'Song',
'source': 'Spotify',
'supported_features': <MediaPlayerEntityFeature: 0>,
'volume_level': 0.22580323309042688,
}),
@ -62,6 +69,6 @@
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'idle',
'state': 'playing',
})
# ---

View file

@ -22,6 +22,8 @@ async def test_media_player(
freezer: FrozenDateTimeFactory,
snapshot: SnapshotAssertion,
entity_registry: er.EntityRegistry,
mock_get_state,
mock_get_status,
) -> None:
"""Tests that the media player entity is correct when idle."""
@ -38,6 +40,7 @@ async def test_media_player(
# The refresh fixture has music playing
freezer.tick(WAIT)
async_fire_time_changed(hass)
await hass.async_block_till_done(wait_background_tasks=True)
assert hass.states.get(entity_entry.entity_id) == snapshot(
name=f"{entity_entry.entity_id}-playing"