mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix glances config-flow flaky test (#77549)
This commit is contained in:
parent
df214c2d26
commit
9cdb7bba4c
@ -441,7 +441,6 @@ omit =
|
||||
homeassistant/components/gitlab_ci/sensor.py
|
||||
homeassistant/components/gitter/sensor.py
|
||||
homeassistant/components/glances/__init__.py
|
||||
homeassistant/components/glances/const.py
|
||||
homeassistant/components/glances/sensor.py
|
||||
homeassistant/components/goalfeed/*
|
||||
homeassistant/components/goodwe/__init__.py
|
||||
|
@ -13,7 +13,4 @@ DEFAULT_SCAN_INTERVAL = 60
|
||||
DATA_UPDATED = "glances_data_updated"
|
||||
SUPPORTED_VERSIONS = [2, 3]
|
||||
|
||||
if sys.maxsize > 2**32:
|
||||
CPU_ICON = "mdi:cpu-64-bit"
|
||||
else:
|
||||
CPU_ICON = "mdi:cpu-32-bit"
|
||||
CPU_ICON = f"mdi:cpu-{64 if sys.maxsize > 2**32 else 32}-bit"
|
||||
|
@ -7,6 +7,7 @@ import pytest
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant.components import glances
|
||||
from homeassistant.const import CONF_SCAN_INTERVAL
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -36,7 +37,7 @@ def glances_setup_fixture():
|
||||
yield
|
||||
|
||||
|
||||
async def test_form(hass):
|
||||
async def test_form(hass: HomeAssistant) -> None:
|
||||
"""Test config entry configured successfully."""
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
@ -56,7 +57,7 @@ async def test_form(hass):
|
||||
assert result["data"] == DEMO_USER_INPUT
|
||||
|
||||
|
||||
async def test_form_cannot_connect(hass):
|
||||
async def test_form_cannot_connect(hass: HomeAssistant) -> None:
|
||||
"""Test to return error if we cannot connect."""
|
||||
|
||||
with patch(
|
||||
@ -74,7 +75,7 @@ async def test_form_cannot_connect(hass):
|
||||
assert result["errors"] == {"base": "cannot_connect"}
|
||||
|
||||
|
||||
async def test_form_wrong_version(hass):
|
||||
async def test_form_wrong_version(hass: HomeAssistant) -> None:
|
||||
"""Test to check if wrong version is entered."""
|
||||
|
||||
user_input = DEMO_USER_INPUT.copy()
|
||||
@ -90,7 +91,7 @@ async def test_form_wrong_version(hass):
|
||||
assert result["errors"] == {"version": "wrong_version"}
|
||||
|
||||
|
||||
async def test_form_already_configured(hass):
|
||||
async def test_form_already_configured(hass: HomeAssistant) -> None:
|
||||
"""Test host is already configured."""
|
||||
entry = MockConfigEntry(
|
||||
domain=glances.DOMAIN, data=DEMO_USER_INPUT, options={CONF_SCAN_INTERVAL: 60}
|
||||
@ -107,12 +108,14 @@ async def test_form_already_configured(hass):
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
async def test_options(hass):
|
||||
async def test_options(hass: HomeAssistant) -> None:
|
||||
"""Test options for Glances."""
|
||||
entry = MockConfigEntry(
|
||||
domain=glances.DOMAIN, data=DEMO_USER_INPUT, options={CONF_SCAN_INTERVAL: 60}
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
result = await hass.config_entries.options.async_init(entry.entry_id)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user