2020-04-05 16:03:13 +00:00
|
|
|
"""Tests for the lastfm sensor."""
|
2021-01-01 21:31:56 +00:00
|
|
|
|
2023-07-22 10:47:26 +00:00
|
|
|
import pytest
|
|
|
|
from syrupy.assertion import SnapshotAssertion
|
2020-04-05 16:03:13 +00:00
|
|
|
|
2023-02-13 13:38:37 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
2020-04-05 16:03:13 +00:00
|
|
|
|
2023-06-08 20:55:16 +00:00
|
|
|
from .conftest import ComponentSetup
|
2020-04-05 16:03:13 +00:00
|
|
|
|
2023-05-25 12:48:16 +00:00
|
|
|
from tests.common import MockConfigEntry
|
2021-09-16 05:00:25 +00:00
|
|
|
|
2023-06-08 20:55:16 +00:00
|
|
|
|
2023-07-22 10:47:26 +00:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
("fixture"),
|
|
|
|
[
|
|
|
|
("not_found_user"),
|
|
|
|
("first_time_user"),
|
|
|
|
("default_user"),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
async def test_sensors(
|
2023-06-08 20:55:16 +00:00
|
|
|
hass: HomeAssistant,
|
|
|
|
setup_integration: ComponentSetup,
|
|
|
|
config_entry: MockConfigEntry,
|
2023-07-22 10:47:26 +00:00
|
|
|
snapshot: SnapshotAssertion,
|
|
|
|
fixture: str,
|
|
|
|
request: pytest.FixtureRequest,
|
2023-06-08 20:55:16 +00:00
|
|
|
) -> None:
|
2023-07-22 10:47:26 +00:00
|
|
|
"""Test sensors."""
|
|
|
|
user = request.getfixturevalue(fixture)
|
|
|
|
await setup_integration(config_entry, user)
|
2023-06-08 20:55:16 +00:00
|
|
|
|
2023-08-21 20:31:04 +00:00
|
|
|
entity_id = "sensor.lastfm_testaccount1"
|
2020-04-05 16:03:13 +00:00
|
|
|
|
|
|
|
state = hass.states.get(entity_id)
|
|
|
|
|
2023-07-22 10:47:26 +00:00
|
|
|
assert state == snapshot
|