Skip to content

Commit

Permalink
Migrate device_joined (test_gateway)
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly committed Oct 2, 2024
1 parent 4b24f41 commit 84b5972
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/test_gateway.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Test ZHA Gateway."""

import asyncio
from collections.abc import Awaitable, Callable
from collections.abc import Callable
from unittest.mock import AsyncMock, MagicMock, PropertyMock, call, patch

import pytest
Expand All @@ -14,7 +14,7 @@
import zigpy.zdo.types as zdo_t
from zigpy.zdo.types import LogicalType, NodeDescriptor

from tests.common import get_entity, get_group_entity
from tests.common import get_entity, get_group_entity, join_zigpy_device
from tests.conftest import SIG_EP_INPUT, SIG_EP_OUTPUT, SIG_EP_PROFILE, SIG_EP_TYPE
from zha.application import Platform
from zha.application.const import (
Expand Down Expand Up @@ -59,19 +59,19 @@ def zigpy_dev_basic(zigpy_device_mock: Callable[..., ZigpyDevice]) -> ZigpyDevic

@pytest.fixture
async def zha_dev_basic(
device_joined: Callable[[ZigpyDevice], Awaitable[Device]],
zha_gateway: Gateway,
zigpy_dev_basic: ZigpyDevice, # pylint: disable=redefined-outer-name
) -> Device:
"""ZHA device with just a basic cluster."""

zha_device = await device_joined(zigpy_dev_basic)
zha_device = await join_zigpy_device(zha_gateway, zigpy_dev_basic)
return zha_device


@pytest.fixture
async def coordinator(
zigpy_device_mock: Callable[..., ZigpyDevice],
device_joined: Callable[[ZigpyDevice], Awaitable[Device]],
zha_gateway: Gateway,
) -> Device:
"""Test ZHA light platform."""

Expand Down Expand Up @@ -108,15 +108,15 @@ async def coordinator(
descriptor_capability_field=zdo_t.NodeDescriptor.DescriptorCapability.NONE,
),
)
zha_device = await device_joined(zigpy_device)
zha_device = await join_zigpy_device(zha_gateway, zigpy_device)
zha_device.available = True
return zha_device


@pytest.fixture
async def device_light_1(
zigpy_device_mock: Callable[..., ZigpyDevice],
device_joined: Callable[[ZigpyDevice], Awaitable[Device]],
zha_gateway: Gateway,
) -> Device:
"""Test ZHA light platform."""

Expand All @@ -138,15 +138,15 @@ async def device_light_1(
manufacturer="Philips",
model="LWA004",
)
zha_device = await device_joined(zigpy_device)
zha_device = await join_zigpy_device(zha_gateway, zigpy_device)
zha_device.available = True
return zha_device


@pytest.fixture
async def device_light_2(
zigpy_device_mock: Callable[..., ZigpyDevice],
device_joined: Callable[[ZigpyDevice], Awaitable[Device]],
zha_gateway: Gateway,
) -> Device:
"""Test ZHA light platform."""

Expand All @@ -167,7 +167,7 @@ async def device_light_2(
ieee=IEEE_GROUPABLE_DEVICE2,
manufacturer="Sengled",
)
zha_device = await device_joined(zigpy_device)
zha_device = await join_zigpy_device(zha_gateway, zigpy_device)
zha_device.available = True
return zha_device

Expand Down

0 comments on commit 84b5972

Please sign in to comment.