Skip to content

Commit 92c835d

Browse files
author
KP
committed
[minor] fix for SHA-2 test when ssl isn't available
1 parent 85c611c commit 92c835d

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

tests/test_api.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66

77
import datetime
8+
import sys
89
import os
910
import re
1011
from mock import patch, Mock, MagicMock
@@ -1483,11 +1484,19 @@ def test_sha2_error(self, mock_request):
14831484
# ensure we're starting with the right values
14841485
self.sg.reset_user_agent()
14851486

1486-
# ensure the initial settings are correct
1487-
self.assertFalse(self.sg.config.no_ssl_validation)
1488-
self.assertFalse(shotgun_api3.shotgun.NO_SSL_VALIDATION)
1489-
self.assertTrue("(validate)" in " ".join(self.sg._user_agents))
1490-
self.assertFalse("(no-validate)" in " ".join(self.sg._user_agents))
1487+
# ensure the initial settings are correct. These will be different depending on whether
1488+
# the ssl module imported successfully or not.
1489+
if "ssl" in sys.modules:
1490+
self.assertFalse(self.sg.config.no_ssl_validation)
1491+
self.assertFalse(shotgun_api3.shotgun.NO_SSL_VALIDATION)
1492+
self.assertTrue("(validate)" in " ".join(self.sg._user_agents))
1493+
self.assertFalse("(no-validate)" in " ".join(self.sg._user_agents))
1494+
else:
1495+
self.assertTrue(self.sg.config.no_ssl_validation)
1496+
self.assertTrue(shotgun_api3.shotgun.NO_SSL_VALIDATION)
1497+
self.assertFalse("(validate)" in " ".join(self.sg._user_agents))
1498+
self.assertTrue("(no-validate)" in " ".join(self.sg._user_agents))
1499+
14911500
try:
14921501
result = self.sg.info()
14931502
except SSLHandshakeError:

0 commit comments

Comments
 (0)