Correct device_class test for mqtt button (#101500)

This commit is contained in:
Jan Bouwhuis 2023-10-06 09:11:50 +02:00 committed by GitHub
parent da770df13f
commit 2bfb1e75d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -443,7 +443,7 @@ async def test_entity_debug_info_message(
mqtt.DOMAIN: {
button.DOMAIN: {
"name": "test",
"state_topic": "test-topic",
"command_topic": "test-topic",
"device_class": "foobarnotreal",
}
}
@ -451,11 +451,14 @@ async def test_entity_debug_info_message(
],
)
async def test_invalid_device_class(
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
hass: HomeAssistant,
mqtt_mock_entry: MqttMockHAClientGenerator,
caplog: pytest.LogCaptureFixture,
) -> None:
"""Test device_class option with invalid value."""
with pytest.raises(AssertionError):
await mqtt_mock_entry()
assert "expected ButtonDeviceClass" in caplog.text
@pytest.mark.parametrize(