1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Create httpx helper to wrap a shared httpx.AsyncClient (#43877)

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
J. Nick Koston
2020-12-09 10:18:57 -06:00
committed by GitHub
parent 12903f9c8c
commit dd0afc3b66
8 changed files with 284 additions and 30 deletions

View File

@@ -6,8 +6,10 @@ import httpx
import respx
from homeassistant import config as hass_config
from homeassistant.components.homeassistant import SERVICE_UPDATE_ENTITY
import homeassistant.components.sensor as sensor
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_UNIT_OF_MEASUREMENT,
CONTENT_TYPE_JSON,
DATA_MEGABYTES,
@@ -151,10 +153,21 @@ async def test_setup_get(hass):
}
},
)
await async_setup_component(hass, "homeassistant", {})
await hass.async_block_till_done()
assert len(hass.states.async_all()) == 1
assert hass.states.get("sensor.foo").state == ""
await hass.services.async_call(
"homeassistant",
SERVICE_UPDATE_ENTITY,
{ATTR_ENTITY_ID: "sensor.foo"},
blocking=True,
)
await hass.async_block_till_done()
assert hass.states.get("sensor.foo").state == ""
@respx.mock
async def test_setup_get_digest_auth(hass):