Cleanup tag integration (#118241)

* Cleanup tag integration

* Fix review comments
This commit is contained in:
G Johansson
2024-05-27 21:53:06 +02:00
committed by GitHub
parent c349797938
commit 6067ea2454
4 changed files with 20 additions and 17 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ TEST_DEVICE_ID = "device id"
@pytest.fixture
def storage_setup_named_tag(
hass,
hass: HomeAssistant,
hass_storage,
):
"""Storage setup for test case of named tags."""
@@ -67,7 +67,7 @@ async def test_named_tag_scanned_event(
@pytest.fixture
def storage_setup_unnamed_tag(hass, hass_storage):
def storage_setup_unnamed_tag(hass: HomeAssistant, hass_storage):
"""Storage setup for test case of unnamed tags."""
async def _storage(items=None):
+3 -3
View File
@@ -3,7 +3,7 @@
from freezegun.api import FrozenDateTimeFactory
import pytest
from homeassistant.components.tag import DOMAIN, TAGS, async_scan_tag
from homeassistant.components.tag import DOMAIN, async_scan_tag
from homeassistant.core import HomeAssistant
from homeassistant.helpers import collection
from homeassistant.setup import async_setup_component
@@ -13,7 +13,7 @@ from tests.typing import WebSocketGenerator
@pytest.fixture
def storage_setup(hass, hass_storage):
def storage_setup(hass: HomeAssistant, hass_storage):
"""Storage setup."""
async def _storage(items=None):
@@ -128,7 +128,7 @@ async def test_tag_id_exists(
) -> None:
"""Test scanning tags."""
assert await storage_setup()
changes = track_changes(hass.data[DOMAIN][TAGS])
changes = track_changes(hass.data[DOMAIN])
client = await hass_ws_client(hass)
await client.send_json({"id": 2, "type": f"{DOMAIN}/create", "tag_id": "test tag"})
+2 -2
View File
@@ -18,7 +18,7 @@ def stub_blueprint_populate_autouse(stub_blueprint_populate: None) -> None:
@pytest.fixture
def tag_setup(hass, hass_storage):
def tag_setup(hass: HomeAssistant, hass_storage):
"""Tag setup."""
async def _storage(items=None):
@@ -37,7 +37,7 @@ def tag_setup(hass, hass_storage):
@pytest.fixture
def calls(hass):
def calls(hass: HomeAssistant):
"""Track calls to a mock service."""
return async_mock_service(hass, "test", "automation")