This commit is contained in:
J. Nick Koston 2023-11-19 10:58:30 -06:00
parent 541cd531f8
commit 1492e14077
No known key found for this signature in database

View File

@ -7,7 +7,6 @@ from asyncclick.testing import CliRunner
from kasa import SmartDevice, TPLinkSmartHomeProtocol from kasa import SmartDevice, TPLinkSmartHomeProtocol
from kasa.cli import ( from kasa.cli import (
TYPE_TO_CLASS,
alias, alias,
brightness, brightness,
cli, cli,
@ -17,6 +16,8 @@ from kasa.cli import (
sysinfo, sysinfo,
toggle, toggle,
) )
from kasa.device_factory import DEVICE_TYPE_TO_CLASS
from kasa.device_type import DeviceType
from kasa.discover import Discover from kasa.discover import Discover
from .conftest import handle_turn_on, turn_on from .conftest import handle_turn_on, turn_on
@ -154,14 +155,9 @@ async def test_credentials(discovery_data: dict, mocker):
) )
mocker.patch("kasa.cli.state", new=_state) mocker.patch("kasa.cli.state", new=_state)
cli_device_type = Discover._get_device_class(discovery_data)(
# Get the type string parameter from the discovery_info "any"
for cli_device_type in { # noqa: B007 ).device_type.value
i
for i in TYPE_TO_CLASS
if TYPE_TO_CLASS[i] == Discover._get_device_class(discovery_data)
}:
break
runner = CliRunner() runner = CliRunner()
res = await runner.invoke( res = await runner.invoke(