Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions redis_sentinel_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def parse_host(s):
option_types = {
'socket_timeout': float,
'socket_connect_timeout': float,
'ssl': lambda opt: bool(int(opt)),
}

sentinel_url_options = {}
Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Operating System :: OS Independent',
'License :: OSI Approved :: Apache Software License',
'Development Status :: 5 - Production/Stable',
Expand Down
17 changes: 17 additions & 0 deletions test_redis_sentinel_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@ def test_slave_service(self):
'redis+sentinel://hostname:7000/theslave?client_type=slave')
self.assertEqual(parsed.default_client, DefaultClient('slave', 'theslave'))

def test_ssl(self):
parsed = parse_sentinel_url('redis+sentinel://hostname:7000/?ssl=1')
self.assertDictEqual(parsed.client_options, {'db': 0, 'ssl': True})

parsed = parse_sentinel_url('redis+sentinel://hostname:7000/?ssl=0')
self.assertDictEqual(parsed.client_options, {'db': 0, 'ssl': False})

parsed = parse_sentinel_url('redis+sentinel://hostname:7000/?sentinel_ssl=1')
self.assertDictEqual(parsed.sentinel_options, {'ssl': True})

parsed = parse_sentinel_url('redis+sentinel://hostname:7000/?sentinel_ssl=0')
self.assertDictEqual(parsed.sentinel_options, {'ssl': False})

parsed = parse_sentinel_url('redis+sentinel://hostname:7000/?sentinel_ssl=1&ssl=1')
self.assertDictEqual(parsed.client_options, {'db': 0, 'ssl': True})
self.assertDictEqual(parsed.sentinel_options, {'ssl': True})

def test_invalid_client_type(self):
with self.assertRaises(ValueError):
parse_sentinel_url(
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27,py33,py34,py35,py36,pypy
envlist = py27,py35,py36,py37,py38,py39,py310,pypy
[testenv]
deps =
mock
Expand Down