Add UnsupportedEncryptionError for unsupported encryption schemes (#1866)
Some checks failed
CI / Perform Lint Checks (3.15) (push) Has been cancelled
CI / Python 3.11 on macos-latest (push) Has been cancelled
CI / Python 3.12 on macos-latest (push) Has been cancelled
CI / Python 3.13 on macos-latest (push) Has been cancelled
CI / Python 3.14 on macos-latest (push) Has been cancelled
CI / Python 3.15 on macos-latest (push) Has been cancelled
CI / Python 3.11 on ubuntu-latest (push) Has been cancelled
CI / Python 3.12 on ubuntu-latest (push) Has been cancelled
CI / Python 3.13 on ubuntu-latest (push) Has been cancelled
CI / Python 3.14 on ubuntu-latest (push) Has been cancelled
CI / Python 3.15 on ubuntu-latest (push) Has been cancelled
CI / Python 3.11 on windows-latest (push) Has been cancelled
CI / Python 3.12 on windows-latest (push) Has been cancelled
CI / Python 3.13 on windows-latest (push) Has been cancelled
CI / Python 3.14 on windows-latest (push) Has been cancelled
CI / Python 3.15 on windows-latest (push) Has been cancelled
CodeQL Checks / Analyze (python) (push) Has been cancelled

This commit is contained in:
Teemu R.
2026-11-28 01:13:53 +01:00
committed by GitHub
parent 422194e5eb
commit 6a35bb6e53
8 changed files with 53 additions and 13 deletions

View File

@@ -41,7 +41,11 @@ from kasa.discover import (
_DiscoverProtocol,
json_dumps,
)
from kasa.exceptions import AuthenticationError, UnsupportedDeviceError
from kasa.exceptions import (
AuthenticationError,
UnsupportedDeviceError,
UnsupportedEncryptionError,
)
from kasa.iot import IotDevice, IotPlug
from kasa.transports.aestransport import AesEncyptionSession
from kasa.transports.xortransport import XorEncryption, XorTransport
@@ -816,12 +820,10 @@ async def test_connection_parameters_unsupported_encrypt_type():
},
}
with pytest.raises(
UnsupportedDeviceError,
match=(
r"^Device 127\.0\.0\.123 \(SMART\.TAPOROBOVAC\) uses unsupported "
r"encryption type TPAP$"
),
UnsupportedEncryptionError,
match=r"encryption type TPAP, enabling third-party compatibility",
) as exc_info:
Discover._get_connection_parameters(DiscoveryResult.from_dict(result))
assert exc_info.value.host == "127.0.0.123"
assert exc_info.value.discovery_result
assert exc_info.value.encryption_type == "TPAP"