From 018af9eca361a4978ebf49c86a871adb40c890a9 Mon Sep 17 00:00:00 2001 From: sdb9696 Date: Fri, 26 Jan 2024 07:42:59 +0000 Subject: [PATCH] Add test --- kasa/tests/test_protocol.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kasa/tests/test_protocol.py b/kasa/tests/test_protocol.py index 78a8ea1e..e71f4296 100644 --- a/kasa/tests/test_protocol.py +++ b/kasa/tests/test_protocol.py @@ -602,3 +602,16 @@ async def test_protocol_will_retry_on_write( expected_call_count = retry_count + 1 if retry_expectation else 1 assert conn.call_count == expected_call_count assert write_mock.call_count == expected_call_count + + +def test_deprecated_protocol(): + with pytest.deprecated_call(): + from kasa import TPLinkSmartHomeProtocol + + with pytest.raises( + SmartDeviceException, match="host or transport must be supplied" + ): + proto = TPLinkSmartHomeProtocol() + host = "127.0.0.1" + proto = TPLinkSmartHomeProtocol(host=host) + assert proto.config.host == host