Skip to content

Commit dfc3044

Browse files
author
nazarfil
committed
test: added untracked test files
1 parent 7a311d1 commit dfc3044

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

tests/test_ssl_errors.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""SSL error handling test module."""
2+
3+
4+
import requests
5+
6+
from openhexa.utils.session import create_requests_session
7+
8+
9+
class TestSSLErrorHandling:
10+
"""Test SSL error handling functionality."""
11+
12+
def test_create_requests_session_verify_default(self):
13+
"""Test create_requests_session with default verify parameter."""
14+
session = create_requests_session()
15+
assert session.verify is True
16+
17+
def test_ssl_error_handling_logic(self):
18+
"""Test that SSL errors are properly converted to GraphQLError."""
19+
ssl_error = requests.exceptions.SSLError("CERTIFICATE_VERIFY_FAILED error")
20+
21+
if "CERTIFICATE_VERIFY_FAILED" in str(ssl_error):
22+
expected_msg = (
23+
"SSL certificate verification failed. "
24+
"If you want to disable SSL verification, set the environment variable: HEXA_VERIFY_SSL=false"
25+
)
26+
assert "SSL certificate verification failed" in expected_msg
27+
assert "HEXA_VERIFY_SSL=false" in expected_msg
28+
29+
other_ssl_error = requests.exceptions.SSLError("Some other SSL error")
30+
assert "Some other SSL error" in str(other_ssl_error)

0 commit comments

Comments
 (0)