mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Use entity_registry_enabled_by_default
fixture in Kraken tests (#101379)
Use entity_registry_enabled_by_default fixture
This commit is contained in:
parent
17779c5f0c
commit
ab6f617797
@ -13,7 +13,7 @@ from homeassistant.components.kraken.const import (
|
|||||||
)
|
)
|
||||||
from homeassistant.const import CONF_SCAN_INTERVAL, EVENT_HOMEASSISTANT_START
|
from homeassistant.const import CONF_SCAN_INTERVAL, EVENT_HOMEASSISTANT_START
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
from homeassistant.helpers import device_registry as dr
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
MISSING_PAIR_TICKER_INFORMATION_RESPONSE,
|
MISSING_PAIR_TICKER_INFORMATION_RESPONSE,
|
||||||
@ -25,7 +25,11 @@ from .const import (
|
|||||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||||
|
|
||||||
|
|
||||||
async def test_sensor(hass: HomeAssistant, freezer: FrozenDateTimeFactory) -> None:
|
async def test_sensor(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
freezer: FrozenDateTimeFactory,
|
||||||
|
entity_registry_enabled_by_default: None,
|
||||||
|
) -> None:
|
||||||
"""Test that sensor has a value."""
|
"""Test that sensor has a value."""
|
||||||
with patch(
|
with patch(
|
||||||
"pykrakenapi.KrakenAPI.get_tradable_asset_pairs",
|
"pykrakenapi.KrakenAPI.get_tradable_asset_pairs",
|
||||||
@ -51,105 +55,6 @@ async def test_sensor(hass: HomeAssistant, freezer: FrozenDateTimeFactory) -> No
|
|||||||
)
|
)
|
||||||
entry.add_to_hass(hass)
|
entry.add_to_hass(hass)
|
||||||
|
|
||||||
registry = er.async_get(hass)
|
|
||||||
|
|
||||||
# Pre-create registry entries for disabled by default sensors
|
|
||||||
registry.async_get_or_create(
|
|
||||||
"sensor",
|
|
||||||
DOMAIN,
|
|
||||||
"xbt_usd_ask_volume",
|
|
||||||
suggested_object_id="xbt_usd_ask_volume",
|
|
||||||
disabled_by=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
registry.async_get_or_create(
|
|
||||||
"sensor",
|
|
||||||
DOMAIN,
|
|
||||||
"xbt_usd_last_trade_closed",
|
|
||||||
suggested_object_id="xbt_usd_last_trade_closed",
|
|
||||||
disabled_by=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
registry.async_get_or_create(
|
|
||||||
"sensor",
|
|
||||||
DOMAIN,
|
|
||||||
"xbt_usd_bid_volume",
|
|
||||||
suggested_object_id="xbt_usd_bid_volume",
|
|
||||||
disabled_by=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
registry.async_get_or_create(
|
|
||||||
"sensor",
|
|
||||||
DOMAIN,
|
|
||||||
"xbt_usd_volume_today",
|
|
||||||
suggested_object_id="xbt_usd_volume_today",
|
|
||||||
disabled_by=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
registry.async_get_or_create(
|
|
||||||
"sensor",
|
|
||||||
DOMAIN,
|
|
||||||
"xbt_usd_volume_last_24h",
|
|
||||||
suggested_object_id="xbt_usd_volume_last_24h",
|
|
||||||
disabled_by=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
registry.async_get_or_create(
|
|
||||||
"sensor",
|
|
||||||
DOMAIN,
|
|
||||||
"xbt_usd_volume_weighted_average_today",
|
|
||||||
suggested_object_id="xbt_usd_volume_weighted_average_today",
|
|
||||||
disabled_by=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
registry.async_get_or_create(
|
|
||||||
"sensor",
|
|
||||||
DOMAIN,
|
|
||||||
"xbt_usd_volume_weighted_average_last_24h",
|
|
||||||
suggested_object_id="xbt_usd_volume_weighted_average_last_24h",
|
|
||||||
disabled_by=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
registry.async_get_or_create(
|
|
||||||
"sensor",
|
|
||||||
DOMAIN,
|
|
||||||
"xbt_usd_number_of_trades_today",
|
|
||||||
suggested_object_id="xbt_usd_number_of_trades_today",
|
|
||||||
disabled_by=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
registry.async_get_or_create(
|
|
||||||
"sensor",
|
|
||||||
DOMAIN,
|
|
||||||
"xbt_usd_number_of_trades_last_24h",
|
|
||||||
suggested_object_id="xbt_usd_number_of_trades_last_24h",
|
|
||||||
disabled_by=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
registry.async_get_or_create(
|
|
||||||
"sensor",
|
|
||||||
DOMAIN,
|
|
||||||
"xbt_usd_low_last_24h",
|
|
||||||
suggested_object_id="xbt_usd_low_last_24h",
|
|
||||||
disabled_by=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
registry.async_get_or_create(
|
|
||||||
"sensor",
|
|
||||||
DOMAIN,
|
|
||||||
"xbt_usd_high_last_24h",
|
|
||||||
suggested_object_id="xbt_usd_high_last_24h",
|
|
||||||
disabled_by=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
registry.async_get_or_create(
|
|
||||||
"sensor",
|
|
||||||
DOMAIN,
|
|
||||||
"xbt_usd_opening_price_today",
|
|
||||||
suggested_object_id="xbt_usd_opening_price_today",
|
|
||||||
disabled_by=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
await hass.config_entries.async_setup(entry.entry_id)
|
await hass.config_entries.async_setup(entry.entry_id)
|
||||||
|
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user