Add view to get installation type during onboarding (#56095)

This commit is contained in:
Joakim Sørensen 2021-09-11 15:38:38 +02:00 committed by GitHub
parent ec21c5f4a9
commit 1b46190a0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 61 additions and 0 deletions

View file

@ -442,3 +442,40 @@ async def test_onboarding_analytics(hass, hass_storage, hass_client, hass_admin_
resp = await client.post("/api/onboarding/analytics")
assert resp.status == 403
async def test_onboarding_installation_type(hass, hass_storage, hass_client):
"""Test returning installation type during onboarding."""
mock_storage(hass_storage, {"done": []})
await async_setup_component(hass, "persistent_notification", {})
assert await async_setup_component(hass, "onboarding", {})
await hass.async_block_till_done()
client = await hass_client()
with patch(
"homeassistant.components.onboarding.views.async_get_system_info",
return_value={"installation_type": "Home Assistant Core"},
):
resp = await client.get("/api/onboarding/installation_type")
assert resp.status == 200
resp_content = await resp.json()
assert resp_content["installation_type"] == "Home Assistant Core"
async def test_onboarding_installation_type_after_done(hass, hass_storage, hass_client):
"""Test raising for installation type after onboarding."""
mock_storage(hass_storage, {"done": [const.STEP_USER]})
await async_setup_component(hass, "persistent_notification", {})
assert await async_setup_component(hass, "onboarding", {})
await hass.async_block_till_done()
client = await hass_client()
resp = await client.get("/api/onboarding/installation_type")
assert resp.status == 401