Add parental control switches to NextDNS integration (#76559)
* Add new switches * Make new switches disabled by default * Update tests
This commit is contained in:
parent
6e9c67c203
commit
681b726128
2 changed files with 1009 additions and 0 deletions
|
@ -184,6 +184,342 @@ SWITCHES = (
|
|||
icon="mdi:youtube",
|
||||
state=lambda data: data.youtube_restricted_mode,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_9gag",
|
||||
name="Block 9GAG",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:file-gif-box",
|
||||
state=lambda data: data.block_9gag,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_amazon",
|
||||
name="Block Amazon",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:cart-outline",
|
||||
state=lambda data: data.block_amazon,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_blizzard",
|
||||
name="Block Blizzard",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:sword-cross",
|
||||
state=lambda data: data.block_blizzard,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_dailymotion",
|
||||
name="Block Dailymotion",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:movie-search-outline",
|
||||
state=lambda data: data.block_dailymotion,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_discord",
|
||||
name="Block Discord",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:message-text",
|
||||
state=lambda data: data.block_discord,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_disneyplus",
|
||||
name="Block Disney Plus",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:movie-search-outline",
|
||||
state=lambda data: data.block_disneyplus,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_ebay",
|
||||
name="Block eBay",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:basket-outline",
|
||||
state=lambda data: data.block_ebay,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_facebook",
|
||||
name="Block Facebook",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:facebook",
|
||||
state=lambda data: data.block_facebook,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_fortnite",
|
||||
name="Block Fortnite",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:tank",
|
||||
state=lambda data: data.block_fortnite,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_hulu",
|
||||
name="Block Hulu",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:hulu",
|
||||
state=lambda data: data.block_hulu,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_imgur",
|
||||
name="Block Imgur",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:camera-image",
|
||||
state=lambda data: data.block_imgur,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_instagram",
|
||||
name="Block Instagram",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:instagram",
|
||||
state=lambda data: data.block_instagram,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_leagueoflegends",
|
||||
name="Block League of Legends",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:sword",
|
||||
state=lambda data: data.block_leagueoflegends,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_messenger",
|
||||
name="Block Messenger",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:message-text",
|
||||
state=lambda data: data.block_messenger,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_minecraft",
|
||||
name="Block Minecraft",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:minecraft",
|
||||
state=lambda data: data.block_minecraft,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_netflix",
|
||||
name="Block Netflix",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:netflix",
|
||||
state=lambda data: data.block_netflix,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_pinterest",
|
||||
name="Block Pinterest",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:pinterest",
|
||||
state=lambda data: data.block_pinterest,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_primevideo",
|
||||
name="Block Prime Video",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:filmstrip",
|
||||
state=lambda data: data.block_primevideo,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_reddit",
|
||||
name="Block Reddit",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:reddit",
|
||||
state=lambda data: data.block_reddit,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_roblox",
|
||||
name="Block Roblox",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:robot",
|
||||
state=lambda data: data.block_roblox,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_signal",
|
||||
name="Block Signal",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:chat-outline",
|
||||
state=lambda data: data.block_signal,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_skype",
|
||||
name="Block Skype",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:skype",
|
||||
state=lambda data: data.block_skype,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_snapchat",
|
||||
name="Block Snapchat",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:snapchat",
|
||||
state=lambda data: data.block_snapchat,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_spotify",
|
||||
name="Block Spotify",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:spotify",
|
||||
state=lambda data: data.block_spotify,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_steam",
|
||||
name="Block Steam",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:steam",
|
||||
state=lambda data: data.block_steam,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_telegram",
|
||||
name="Block Telegram",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:send-outline",
|
||||
state=lambda data: data.block_telegram,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_tiktok",
|
||||
name="Block TikTok",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:music-note",
|
||||
state=lambda data: data.block_tiktok,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_tinder",
|
||||
name="Block Tinder",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:fire",
|
||||
state=lambda data: data.block_tinder,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_tumblr",
|
||||
name="Block Tumblr",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:image-outline",
|
||||
state=lambda data: data.block_tumblr,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_twitch",
|
||||
name="Block Twitch",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:twitch",
|
||||
state=lambda data: data.block_twitch,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_twitter",
|
||||
name="Block Twitter",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:twitter",
|
||||
state=lambda data: data.block_twitter,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_vimeo",
|
||||
name="Block Vimeo",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:vimeo",
|
||||
state=lambda data: data.block_vimeo,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_vk",
|
||||
name="Block VK",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:power-socket-eu",
|
||||
state=lambda data: data.block_vk,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_whatsapp",
|
||||
name="Block WhatsApp",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:whatsapp",
|
||||
state=lambda data: data.block_whatsapp,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_xboxlive",
|
||||
name="Block Xbox Live",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:microsoft-xbox",
|
||||
state=lambda data: data.block_xboxlive,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_youtube",
|
||||
name="Block YouTube",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:youtube",
|
||||
state=lambda data: data.block_youtube,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_zoom",
|
||||
name="Block Zoom",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:video",
|
||||
state=lambda data: data.block_zoom,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_dating",
|
||||
name="Block dating",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:candelabra",
|
||||
state=lambda data: data.block_dating,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_gambling",
|
||||
name="Block gambling",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:slot-machine",
|
||||
state=lambda data: data.block_gambling,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_piracy",
|
||||
name="Block piracy",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:pirate",
|
||||
state=lambda data: data.block_piracy,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_porn",
|
||||
name="Block porn",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:movie-off",
|
||||
state=lambda data: data.block_porn,
|
||||
),
|
||||
NextDnsSwitchEntityDescription[Settings](
|
||||
key="block_social_networks",
|
||||
name="Block social networks",
|
||||
entity_category=EntityCategory.CONFIG,
|
||||
entity_registry_enabled_default=False,
|
||||
icon="mdi:facebook",
|
||||
state=lambda data: data.block_social_networks,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ from unittest.mock import patch
|
|||
|
||||
from nextdns import ApiError
|
||||
|
||||
from homeassistant.components.nextdns.const import DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
@ -26,6 +27,342 @@ async def test_switch(hass: HomeAssistant) -> None:
|
|||
"""Test states of the switches."""
|
||||
registry = er.async_get(hass)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_9gag",
|
||||
suggested_object_id="fake_profile_block_9gag",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_amazon",
|
||||
suggested_object_id="fake_profile_block_amazon",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_blizzard",
|
||||
suggested_object_id="fake_profile_block_blizzard",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_dailymotion",
|
||||
suggested_object_id="fake_profile_block_dailymotion",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_discord",
|
||||
suggested_object_id="fake_profile_block_discord",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_disneyplus",
|
||||
suggested_object_id="fake_profile_block_disneyplus",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_ebay",
|
||||
suggested_object_id="fake_profile_block_ebay",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_facebook",
|
||||
suggested_object_id="fake_profile_block_facebook",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_fortnite",
|
||||
suggested_object_id="fake_profile_block_fortnite",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_hulu",
|
||||
suggested_object_id="fake_profile_block_hulu",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_imgur",
|
||||
suggested_object_id="fake_profile_block_imgur",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_instagram",
|
||||
suggested_object_id="fake_profile_block_instagram",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_leagueoflegends",
|
||||
suggested_object_id="fake_profile_block_league_of_legends",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_messenger",
|
||||
suggested_object_id="fake_profile_block_messenger",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_minecraft",
|
||||
suggested_object_id="fake_profile_block_minecraft",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_netflix",
|
||||
suggested_object_id="fake_profile_block_netflix",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_pinterest",
|
||||
suggested_object_id="fake_profile_block_pinterest",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_primevideo",
|
||||
suggested_object_id="fake_profile_block_primevideo",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_reddit",
|
||||
suggested_object_id="fake_profile_block_reddit",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_roblox",
|
||||
suggested_object_id="fake_profile_block_roblox",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_signal",
|
||||
suggested_object_id="fake_profile_block_signal",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_skype",
|
||||
suggested_object_id="fake_profile_block_skype",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_snapchat",
|
||||
suggested_object_id="fake_profile_block_snapchat",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_spotify",
|
||||
suggested_object_id="fake_profile_block_spotify",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_steam",
|
||||
suggested_object_id="fake_profile_block_steam",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_telegram",
|
||||
suggested_object_id="fake_profile_block_telegram",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_tiktok",
|
||||
suggested_object_id="fake_profile_block_tiktok",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_tinder",
|
||||
suggested_object_id="fake_profile_block_tinder",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_tumblr",
|
||||
suggested_object_id="fake_profile_block_tumblr",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_twitch",
|
||||
suggested_object_id="fake_profile_block_twitch",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_twitter",
|
||||
suggested_object_id="fake_profile_block_twitter",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_vimeo",
|
||||
suggested_object_id="fake_profile_block_vimeo",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_vk",
|
||||
suggested_object_id="fake_profile_block_vk",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_whatsapp",
|
||||
suggested_object_id="fake_profile_block_whatsapp",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_xboxlive",
|
||||
suggested_object_id="fake_profile_block_xboxlive",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_youtube",
|
||||
suggested_object_id="fake_profile_block_youtube",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_zoom",
|
||||
suggested_object_id="fake_profile_block_zoom",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_dating",
|
||||
suggested_object_id="fake_profile_block_dating",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_gambling",
|
||||
suggested_object_id="fake_profile_block_gambling",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_piracy",
|
||||
suggested_object_id="fake_profile_block_piracy",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_porn",
|
||||
suggested_object_id="fake_profile_block_porn",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
registry.async_get_or_create(
|
||||
SWITCH_DOMAIN,
|
||||
DOMAIN,
|
||||
"xyz12_block_social_networks",
|
||||
suggested_object_id="fake_profile_block_social_networks",
|
||||
disabled_by=None,
|
||||
)
|
||||
|
||||
await init_integration(hass)
|
||||
|
||||
state = hass.states.get("switch.fake_profile_ai_driven_threat_detection")
|
||||
|
@ -218,6 +555,342 @@ async def test_switch(hass: HomeAssistant) -> None:
|
|||
assert entry
|
||||
assert entry.unique_id == "xyz12_web3"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_9gag")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_9gag")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_9gag"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_amazon")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_amazon")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_amazon"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_blizzard")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_blizzard")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_blizzard"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_dailymotion")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_dailymotion")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_dailymotion"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_discord")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_discord")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_discord"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_disneyplus")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_disneyplus")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_disneyplus"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_ebay")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_ebay")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_ebay"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_facebook")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_facebook")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_facebook"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_fortnite")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_fortnite")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_fortnite"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_hulu")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_hulu")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_hulu"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_imgur")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_imgur")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_imgur"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_instagram")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_instagram")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_instagram"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_league_of_legends")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_league_of_legends")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_leagueoflegends"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_messenger")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_messenger")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_messenger"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_minecraft")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_minecraft")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_minecraft"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_netflix")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_netflix")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_netflix"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_pinterest")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_pinterest")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_pinterest"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_primevideo")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_primevideo")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_primevideo"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_reddit")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_reddit")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_reddit"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_roblox")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_roblox")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_roblox"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_signal")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_signal")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_signal"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_skype")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_skype")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_skype"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_snapchat")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_snapchat")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_snapchat"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_spotify")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_spotify")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_spotify"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_steam")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_steam")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_steam"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_telegram")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_telegram")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_telegram"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_tiktok")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_tiktok")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_tiktok"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_tinder")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_tinder")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_tinder"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_tumblr")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_tumblr")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_tumblr"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_twitch")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_twitch")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_twitch"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_twitter")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_twitter")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_twitter"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_vimeo")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_vimeo")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_vimeo"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_vk")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_vk")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_vk"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_whatsapp")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_whatsapp")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_whatsapp"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_xboxlive")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_xboxlive")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_xboxlive"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_youtube")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_youtube")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_youtube"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_zoom")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_zoom")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_zoom"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_dating")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_dating")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_dating"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_gambling")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_gambling")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_gambling"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_piracy")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_piracy")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_piracy"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_porn")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_porn")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_porn"
|
||||
|
||||
state = hass.states.get("switch.fake_profile_block_social_networks")
|
||||
assert state
|
||||
assert state.state == STATE_ON
|
||||
|
||||
entry = registry.async_get("switch.fake_profile_block_social_networks")
|
||||
assert entry
|
||||
assert entry.unique_id == "xyz12_block_social_networks"
|
||||
|
||||
|
||||
async def test_switch_on(hass: HomeAssistant) -> None:
|
||||
"""Test the switch can be turned on."""
|
||||
|
|
Loading…
Add table
Reference in a new issue