mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-01-25 06:07:04 +00:00
make sure it calls discover single without type
This commit is contained in:
parent
1492e14077
commit
ff756a7a79
@ -1,5 +1,4 @@
|
|||||||
import json
|
import json
|
||||||
import sys
|
|
||||||
|
|
||||||
import asyncclick as click
|
import asyncclick as click
|
||||||
import pytest
|
import pytest
|
||||||
@ -16,8 +15,6 @@ 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
|
||||||
@ -177,6 +174,24 @@ async def test_credentials(discovery_data: dict, mocker):
|
|||||||
assert res.output == "Username:foo Password:bar\n"
|
assert res.output == "Username:foo Password:bar\n"
|
||||||
|
|
||||||
|
|
||||||
|
async def test_without_device_type(discovery_data: dict, dev, mocker):
|
||||||
|
"""Test connecting without the device type."""
|
||||||
|
runner = CliRunner()
|
||||||
|
mocker.patch("kasa.discover.Discover.discover_single", return_value=dev)
|
||||||
|
res = await runner.invoke(
|
||||||
|
cli,
|
||||||
|
[
|
||||||
|
"--host",
|
||||||
|
"127.0.0.1",
|
||||||
|
"--username",
|
||||||
|
"foo",
|
||||||
|
"--password",
|
||||||
|
"bar",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
assert res.exit_code == 0
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("auth_param", ["--username", "--password"])
|
@pytest.mark.parametrize("auth_param", ["--username", "--password"])
|
||||||
async def test_invalid_credential_params(auth_param):
|
async def test_invalid_credential_params(auth_param):
|
||||||
"""Test for handling only one of username or password supplied."""
|
"""Test for handling only one of username or password supplied."""
|
||||||
|
Loading…
Reference in New Issue
Block a user