1111import pytest
1212
1313import adafruit_connection_manager
14+ from adafruit_connection_manager import WIZNET5K_SSL_SUPPORT_VERSION
1415
1516
1617def test_connect_esp32spi_https ( # pylint: disable=unused-argument
@@ -51,7 +52,11 @@ def test_connect_wiznet5k_https_not_supported( # pylint: disable=unused-argumen
5152):
5253 mock_pool = mocket .MocketPool ()
5354 radio = mocket .MockRadio .WIZNET5K ()
54- with mock .patch ("sys.implementation" , return_value = [9 , 0 , 0 ]):
55+ old_version = (WIZNET5K_SSL_SUPPORT_VERSION [0 ] - 1 , 0 , 0 )
56+ with mock .patch (
57+ "sys.implementation" ,
58+ (None , old_version )
59+ ):
5560 ssl_context = adafruit_connection_manager .get_radio_ssl_context (radio )
5661 connection_manager = adafruit_connection_manager .ConnectionManager (mock_pool )
5762
@@ -61,3 +66,15 @@ def test_connect_wiznet5k_https_not_supported( # pylint: disable=unused-argumen
6166 mocket .MOCK_HOST_1 , 443 , "https:" , ssl_context = ssl_context
6267 )
6368 assert "This radio does not support TLS/HTTPS" in str (context )
69+
70+
71+ def test_connect_wiznet5k_https_supported ( # pylint: disable=unused-argument
72+ adafruit_wiznet5k_with_ssl_socket_module ,
73+ ):
74+ radio = mocket .MockRadio .WIZNET5K ()
75+ with mock .patch (
76+ "sys.implementation" ,
77+ (None , WIZNET5K_SSL_SUPPORT_VERSION )
78+ ):
79+ ssl_context = adafruit_connection_manager .get_radio_ssl_context (radio )
80+ assert isinstance (ssl_context , ssl .SSLContext )
0 commit comments