File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ def test_data_is_serialized():
7777
7878def test_serialization_unsupported ():
7979 """Tests that when an object that is not serializable is given
80- a type error is raised."""
80+ a type error is raised."""
8181 with pytest .raises (TypeError ):
8282 json_dumps (type ("d" , (), {}))
8383
Original file line number Diff line number Diff line change 11import io
2+ import ssl
23import tempfile
4+ from unittest .mock import patch
35
6+ import urllib3
7+
8+ from crate .client .http import _update_pool_kwargs_for_ssl_minimum_version
49from crate .client .http import super_len
510
611
@@ -49,3 +54,30 @@ class Empty:
4954 pass
5055
5156 assert super_len (Empty ()) is None
57+
58+
59+ def test_update_pool_kwargs_for_ssl_minimum_version ():
60+ """Test that the ssl_minimum_version is set correctly in the kwargs"""
61+ with patch .object (urllib3 , "__version__" , "2.0.0" ):
62+ kwargs = {}
63+ _update_pool_kwargs_for_ssl_minimum_version (
64+ "https://example.com" , kwargs
65+ )
66+ assert (
67+ kwargs .get ("ssl_minimum_version" )
68+ == ssl .TLSVersion .MINIMUM_SUPPORTED
69+ )
70+
71+ # not https
72+ kwargs = {}
73+ _update_pool_kwargs_for_ssl_minimum_version (
74+ "http://example.com" , kwargs
75+ )
76+ assert "ssl_minimum_version" not in kwargs
77+
78+ with patch .object (urllib3 , "__version__" , "1.26.0" ):
79+ kwargs = {}
80+ _update_pool_kwargs_for_ssl_minimum_version (
81+ "https://example.com" , kwargs
82+ )
83+ assert "ssl_minimum_version" not in kwargs
You can’t perform that action at this time.
0 commit comments