mirror of
https://github.com/home-assistant/core
synced 2024-10-05 17:38:03 +00:00
parent
b4775ed2eb
commit
02e2e4d039
|
@ -106,6 +106,31 @@ async def test_setup_minimum(hass: HomeAssistant) -> None:
|
|||
assert len(hass.states.async_all("sensor")) == 1
|
||||
|
||||
|
||||
@respx.mock
|
||||
async def test_setup_encoding(hass: HomeAssistant) -> None:
|
||||
"""Test setup with non-utf8 encoding."""
|
||||
respx.get("http://localhost").respond(
|
||||
status_code=HTTPStatus.OK,
|
||||
stream=httpx.ByteStream("tack själv".encode(encoding="iso-8859-1")),
|
||||
)
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
DOMAIN,
|
||||
{
|
||||
"sensor": {
|
||||
"name": "mysensor",
|
||||
"encoding": "iso-8859-1",
|
||||
"platform": "rest",
|
||||
"resource": "http://localhost",
|
||||
"method": "GET",
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert len(hass.states.async_all("sensor")) == 1
|
||||
assert hass.states.get("sensor.mysensor").state == "tack själv"
|
||||
|
||||
|
||||
@respx.mock
|
||||
async def test_manual_update(hass: HomeAssistant) -> None:
|
||||
"""Test setup with minimum configuration."""
|
||||
|
|
Loading…
Reference in a new issue