File tree Expand file tree Collapse file tree 3 files changed +8
-16
lines changed
Expand file tree Collapse file tree 3 files changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -166,12 +166,8 @@ def __init__(
166166 if self .server_config .type == APIType .LOCAL and verify_ssl :
167167 # To avoid security issues while authentication to local API, we add the following authority to
168168 # our HTTPS client trust store: https://ca.overkiz.com/overkiz-root-ca-2048.crt
169- # Create a copy of the SSL context to avoid mutating the shared global context
170- self ._ssl = ssl .SSLContext (SSL_CONTEXT_LOCAL_API .protocol )
171- self ._ssl .load_verify_locations (
172- cafile = os .path .dirname (os .path .realpath (__file__ ))
173- + "/overkiz-root-ca-2048.crt"
174- )
169+ # Create a new SSL context to avoid mutating the shared global context
170+ self ._ssl = _create_local_ssl_context ()
175171
176172 # Disable strict validation introduced in Python 3.13, which doesn't
177173 # work with Overkiz self-signed gateway certificates
Original file line number Diff line number Diff line change @@ -37,8 +37,9 @@ def create_server_config(
3737 configuration_url : str | None = None ,
3838) -> ServerConfig :
3939 """Generate server configuration with the provided endpoint and metadata."""
40- # ServerConfig.__init__ handles the enum conversion, but mypy doesn't see it
41- # due to attrs @define decorator, so we need type: ignore comments.
40+ # ServerConfig.__init__ handles the enum conversion, but mypy doesn't recognize
41+ # this due to attrs @define decorator generating __init__ with stricter signatures,
42+ # so we need type: ignore comments.
4243 return ServerConfig (
4344 server = server , # type: ignore[arg-type]
4445 name = name ,
Original file line number Diff line number Diff line change 33from __future__ import annotations
44
55import datetime
6- import ssl
7- from unittest .mock import AsyncMock , MagicMock , Mock , patch
6+ from unittest .mock import AsyncMock , MagicMock
87
98import pytest
109from aiohttp import ClientSession
@@ -108,9 +107,7 @@ def test_ensure_username_password_valid(self):
108107 def test_ensure_username_password_invalid (self ):
109108 """Test that invalid credentials raise TypeError."""
110109 creds = TokenCredentials ("token" )
111- with pytest .raises (
112- TypeError , match = "UsernamePasswordCredentials are required"
113- ):
110+ with pytest .raises (TypeError , match = "UsernamePasswordCredentials are required" ):
114111 _ensure_username_password (creds )
115112
116113 def test_ensure_token_valid (self ):
@@ -332,9 +329,7 @@ async def test_build_auth_strategy_wrong_credentials_type(self):
332329 credentials = TokenCredentials ("token" ) # Wrong type for Somfy
333330 session = AsyncMock (spec = ClientSession )
334331
335- with pytest .raises (
336- TypeError , match = "UsernamePasswordCredentials are required"
337- ):
332+ with pytest .raises (TypeError , match = "UsernamePasswordCredentials are required" ):
338333 build_auth_strategy (
339334 server_config = server_config ,
340335 credentials = credentials ,
You can’t perform that action at this time.
0 commit comments