Skip to content

Commit 8ac9c8d

Browse files
committed
Replace ShotgunSSLError by ssl.SSLError
1 parent daea38c commit 8ac9c8d

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
@@ -2258,7 +2253,7 @@ def my_side_effect2(*args, **kwargs):
22582253
@unittest.mock.patch("shotgun_api3.shotgun.Http.request")
22592254
def test_sha2_error(self, mock_request):
22602255
# Simulate the exception raised with SHA-2 errors
2261-
mock_request.side_effect = ShotgunSSLError(
2256+
mock_request.side_effect = ssl.SSLError(
22622257
"[Errno 1] _ssl.c:480: error:0D0C50A1:asn1 "
22632258
"encoding routines:ASN1_item_verify: unknown message digest "
22642259
"algorithm"
@@ -2285,7 +2280,7 @@ def test_sha2_error(self, mock_request):
22852280

22862281
try:
22872282
self.sg.info()
2288-
except ShotgunSSLError:
2283+
except ssl.SSLError:
22892284
# ensure the api has reset the values in the correct fallback behavior
22902285
self.assertTrue(self.sg.config.no_ssl_validation)
22912286
self.assertTrue(shotgun_api3.shotgun.NO_SSL_VALIDATION)
@@ -2298,7 +2293,7 @@ def test_sha2_error(self, mock_request):
22982293
@unittest.mock.patch("shotgun_api3.shotgun.Http.request")
22992294
def test_sha2_error_with_strict(self, mock_request):
23002295
# Simulate the exception raised with SHA-2 errors
2301-
mock_request.side_effect = ShotgunSSLError(
2296+
mock_request.side_effect = ssl.SSLError(
23022297
"[Errno 1] _ssl.c:480: error:0D0C50A1:asn1 "
23032298
"encoding routines:ASN1_item_verify: unknown message digest "
23042299
"algorithm"
@@ -2315,7 +2310,7 @@ def test_sha2_error_with_strict(self, mock_request):
23152310

23162311
try:
23172312
self.sg.info()
2318-
except ShotgunSSLError:
2313+
except ssl.SSLError:
23192314
# ensure the api has NOT reset the values in the fallback behavior because we have
23202315
# set the env variable to force validation
23212316
self.assertFalse(self.sg.config.no_ssl_validation)

0 commit comments

Comments
 (0)