core/tests/components/lastfm/test_sensor.py

38 lines
819 B
Python

"""Tests for the lastfm sensor."""
import pytest
from syrupy.assertion import SnapshotAssertion
from homeassistant.core import HomeAssistant
from .conftest import ComponentSetup
from tests.common import MockConfigEntry
@pytest.mark.parametrize(
("fixture"),
[
("not_found_user"),
("first_time_user"),
("default_user"),
],
)
async def test_sensors(
hass: HomeAssistant,
setup_integration: ComponentSetup,
config_entry: MockConfigEntry,
snapshot: SnapshotAssertion,
fixture: str,
request: pytest.FixtureRequest,
) -> None:
"""Test sensors."""
user = request.getfixturevalue(fixture)
await setup_integration(config_entry, user)
entity_id = "sensor.lastfm_testaccount1"
state = hass.states.get(entity_id)
assert state == snapshot