Skip to content

Commit 6a22d21

Browse files
majiayu000claude
andcommitted
Add test for ssl_password parameter
Add test_ssl_password_parameter test to verify ssl_password is properly passed through to SSLConnection for encrypted private key support. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 6974104 commit 6a22d21

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/test_asyncio/test_ssl.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,29 @@ def capture_context_create_default():
141141

142142
finally:
143143
await r.aclose()
144+
145+
async def test_ssl_password_parameter(self, request):
146+
"""Test that ssl_password parameter is properly passed to SSLConnection"""
147+
ssl_url = request.config.option.redis_ssl_url
148+
parsed_url = urlparse(ssl_url)
149+
150+
# Test with a mock password for encrypted private key
151+
test_password = "test_key_password"
152+
153+
r = redis.Redis(
154+
host=parsed_url.hostname,
155+
port=parsed_url.port,
156+
ssl=True,
157+
ssl_cert_reqs="none",
158+
ssl_password=test_password,
159+
)
160+
161+
try:
162+
# Get the connection to verify ssl_password is passed through
163+
conn = r.connection_pool.make_connection()
164+
assert isinstance(conn, redis.SSLConnection)
165+
166+
# Verify the password is stored in the SSL context
167+
assert conn.ssl_context.password == test_password
168+
finally:
169+
await r.aclose()

0 commit comments

Comments
 (0)