Skip to content

Commit 3cbc5ff

Browse files
committed
Replace ShotgunSSLError by ssl.SSLError
1 parent e7ca1eb commit 3cbc5ff

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

tests/test_api.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@
3131

3232
from shotgun_api3.lib.httplib2 import Http
3333

34-
# To mock the correct exception when testion on Python 2 and 3, use the
35-
# ShotgunSSLError variable from sgsix that contains the appropriate exception
36-
# class for the current Python version.
37-
from shotgun_api3.lib.sgsix import ShotgunSSLError
38-
3934
import shotgun_api3
4035

4136
from . import base
@@ -2260,7 +2255,7 @@ def my_side_effect2(*args, **kwargs):
22602255
@unittest.mock.patch("shotgun_api3.shotgun.Http.request")
22612256
def test_sha2_error(self, mock_request):
22622257
# Simulate the exception raised with SHA-2 errors
2263-
mock_request.side_effect = ShotgunSSLError(
2258+
mock_request.side_effect = ssl.SSLError(
22642259
"[Errno 1] _ssl.c:480: error:0D0C50A1:asn1 "
22652260
"encoding routines:ASN1_item_verify: unknown message digest "
22662261
"algorithm"
@@ -2287,7 +2282,7 @@ def test_sha2_error(self, mock_request):
22872282

22882283
try:
22892284
self.sg.info()
2290-
except ShotgunSSLError:
2285+
except ssl.SSLError:
22912286
# ensure the api has reset the values in the correct fallback behavior
22922287
self.assertTrue(self.sg.config.no_ssl_validation)
22932288
self.assertTrue(shotgun_api3.shotgun.NO_SSL_VALIDATION)
@@ -2300,7 +2295,7 @@ def test_sha2_error(self, mock_request):
23002295
@unittest.mock.patch("shotgun_api3.shotgun.Http.request")
23012296
def test_sha2_error_with_strict(self, mock_request):
23022297
# Simulate the exception raised with SHA-2 errors
2303-
mock_request.side_effect = ShotgunSSLError(
2298+
mock_request.side_effect = ssl.SSLError(
23042299
"[Errno 1] _ssl.c:480: error:0D0C50A1:asn1 "
23052300
"encoding routines:ASN1_item_verify: unknown message digest "
23062301
"algorithm"
@@ -2317,7 +2312,7 @@ def test_sha2_error_with_strict(self, mock_request):
23172312

23182313
try:
23192314
self.sg.info()
2320-
except ShotgunSSLError:
2315+
except ssl.SSLError:
23212316
# ensure the api has NOT reset the values in the fallback behavior because we have
23222317
# set the env variable to force validation
23232318
self.assertFalse(self.sg.config.no_ssl_validation)

0 commit comments

Comments
 (0)