mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +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
|
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
|
@respx.mock
|
||||||
async def test_manual_update(hass: HomeAssistant) -> None:
|
async def test_manual_update(hass: HomeAssistant) -> None:
|
||||||
"""Test setup with minimum configuration."""
|
"""Test setup with minimum configuration."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user