11
11
import pytest
12
12
13
13
import adafruit_connection_manager
14
+ from adafruit_connection_manager import WIZNET5K_SSL_SUPPORT_VERSION
14
15
15
16
16
17
def test_connect_esp32spi_https ( # pylint: disable=unused-argument
@@ -51,7 +52,11 @@ def test_connect_wiznet5k_https_not_supported( # pylint: disable=unused-argumen
51
52
):
52
53
mock_pool = mocket .MocketPool ()
53
54
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
+ ):
55
60
ssl_context = adafruit_connection_manager .get_radio_ssl_context (radio )
56
61
connection_manager = adafruit_connection_manager .ConnectionManager (mock_pool )
57
62
@@ -61,3 +66,15 @@ def test_connect_wiznet5k_https_not_supported( # pylint: disable=unused-argumen
61
66
mocket .MOCK_HOST_1 , 443 , "https:" , ssl_context = ssl_context
62
67
)
63
68
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