mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 18:54:08 +00:00
Pass timeout parameters to discover_single (#744)
* Pass timeout parameters to discover_single * Fix tests
This commit is contained in:
@@ -7,6 +7,7 @@ from asyncclick.testing import CliRunner
|
||||
|
||||
from kasa import (
|
||||
AuthenticationException,
|
||||
Credentials,
|
||||
Device,
|
||||
EmeterStatus,
|
||||
SmartDeviceException,
|
||||
@@ -341,7 +342,9 @@ async def test_credentials(discovery_mock, mocker):
|
||||
async def test_without_device_type(dev, mocker):
|
||||
"""Test connecting without the device type."""
|
||||
runner = CliRunner()
|
||||
mocker.patch("kasa.discover.Discover.discover_single", return_value=dev)
|
||||
discovery_mock = mocker.patch(
|
||||
"kasa.discover.Discover.discover_single", return_value=dev
|
||||
)
|
||||
res = await runner.invoke(
|
||||
cli,
|
||||
[
|
||||
@@ -351,9 +354,18 @@ async def test_without_device_type(dev, mocker):
|
||||
"foo",
|
||||
"--password",
|
||||
"bar",
|
||||
"--discovery-timeout",
|
||||
"7",
|
||||
],
|
||||
)
|
||||
assert res.exit_code == 0
|
||||
discovery_mock.assert_called_once_with(
|
||||
"127.0.0.1",
|
||||
port=None,
|
||||
credentials=Credentials("foo", "bar"),
|
||||
timeout=5,
|
||||
discovery_timeout=7,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("auth_param", ["--username", "--password"])
|
||||
|
Reference in New Issue
Block a user