1212from sqlalchemy .testing import config
1313from sqlalchemy .testing .fixtures import TestBase
1414
15- FINGERPRINT_SECURITY_RATIONALE = (
16- "Only websocket supports giving a fingerprint in the connection"
17- )
18-
1915
2016def get_fingerprint (dsn ):
2117 import websocket
@@ -60,9 +56,10 @@ def remove_ssl_settings(url):
6056 pass
6157 return url .set (query = query )
6258
63- @pytest .mark .skipif (
59+ @pytest .mark .xfail (
6460 testing .db .dialect .server_version_info < (7 , 1 , 0 ),
6561 reason = "DB version(s) before 7.1.0 don't enforce ssl/tls" ,
62+ strict = True ,
6663 )
6764 def test_db_connection_fails_with_default_settings_for_self_signed_certificates (
6865 self ,
@@ -79,10 +76,6 @@ def test_db_connection_fails_with_default_settings_for_self_signed_certificates(
7976 expected_substrings = ["self-signed certificate" , "self signed certificate" ]
8077 assert any ([e in actual_message for e in expected_substrings ])
8178
82- @pytest .mark .skipif (
83- "websocket" not in testing .db .dialect .driver ,
84- reason = "Only websocket supports passing on connect_args like this." ,
85- )
8679 def test_db_skip_certification_validation_passes (self ):
8780 url = self .remove_ssl_settings (config .db .url )
8881
@@ -99,10 +92,6 @@ def test_db_with_ssl_verify_none_passes(self):
9992 result = self .perform_test_query (engine )
10093 assert result == [(42 ,)]
10194
102- @pytest .mark .skipif (
103- "websocket" not in testing .db .dialect .driver ,
104- reason = FINGERPRINT_SECURITY_RATIONALE ,
105- )
10695 def test_db_with_fingerprint_passes (self ):
10796 url = self .remove_ssl_settings (config .db .url )
10897 connect_args = url .translate_connect_args (database = "schema" )
@@ -116,10 +105,6 @@ def test_db_with_fingerprint_passes(self):
116105 result = self .perform_test_query (engine )
117106 assert result == [(42 ,)]
118107
119- @pytest .mark .skipif (
120- "websocket" not in testing .db .dialect .driver ,
121- reason = FINGERPRINT_SECURITY_RATIONALE ,
122- )
123108 def test_db_with_wrong_fingerprint_fails (self ):
124109 url = self .remove_ssl_settings (config .db .url )
125110 connect_args = url .translate_connect_args (database = "schema" )
0 commit comments