From 31094e72a07e377b323a090b28ab82ef6503675d Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Thu, 1 Feb 2024 03:38:16 +0100 Subject: [PATCH] Pass verify_ssl to created session in Omada (#109212) * Pass verify_ssl to created session in Omada * Fix tests * Fix tests --- homeassistant/components/tplink_omada/config_flow.py | 4 +++- tests/components/tplink_omada/test_config_flow.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/tplink_omada/config_flow.py b/homeassistant/components/tplink_omada/config_flow.py index f6a75abe6d8..3f27417894d 100644 --- a/homeassistant/components/tplink_omada/config_flow.py +++ b/homeassistant/components/tplink_omada/config_flow.py @@ -61,7 +61,9 @@ async def create_omada_client( is not None ): # TP-Link API uses cookies for login session, so an unsafe cookie jar is required for IP addresses - websession = async_create_clientsession(hass, cookie_jar=CookieJar(unsafe=True)) + websession = async_create_clientsession( + hass, cookie_jar=CookieJar(unsafe=True), verify_ssl=verify_ssl + ) else: websession = async_get_clientsession(hass, verify_ssl=verify_ssl) diff --git a/tests/components/tplink_omada/test_config_flow.py b/tests/components/tplink_omada/test_config_flow.py index cf3fddf5943..1a9635d44cb 100644 --- a/tests/components/tplink_omada/test_config_flow.py +++ b/tests/components/tplink_omada/test_config_flow.py @@ -401,7 +401,7 @@ async def test_create_omada_client_with_ip_creates_clientsession( hass, { "host": "10.10.10.10", - "verify_ssl": True, # Verify is meaningless for IP + "verify_ssl": True, "username": "test-username", "password": "test-password", }, @@ -412,5 +412,5 @@ async def test_create_omada_client_with_ip_creates_clientsession( "https://10.10.10.10", "test-username", "test-password", "ws" ) mock_create_clientsession.assert_called_once_with( - hass, cookie_jar=mock_jar.return_value + hass, cookie_jar=mock_jar.return_value, verify_ssl=True )