forked from celery/kombu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for setting redis username (celery#1351)
* feat: add support for setting redis username * tests: add redis connparams credentials tests (cherry picked from commit 2d036f5)
- Loading branch information
1 parent
90a12a1
commit 6150dae
Showing
2 changed files
with
17 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -694,6 +694,18 @@ def test_connparams_regular_hostname(self): | |
self.channel.connection.client.hostname = 'george.vandelay.com' | ||
assert self.channel._connparams()['host'] == 'george.vandelay.com' | ||
|
||
def test_connparams_username(self): | ||
self.channel.connection.client.userid = 'kombu' | ||
assert self.channel._connparams()['username'] == 'kombu' | ||
|
||
def test_connparams_client_credentials(self): | ||
self.channel.connection.client.hostname = \ | ||
'redis://foo:[email protected]:6379/0' | ||
connection_parameters = self.channel._connparams() | ||
|
||
assert connection_parameters['username'] == 'foo' | ||
assert connection_parameters['password'] == 'bar' | ||
|
||
def test_connparams_password_for_unix_socket(self): | ||
self.channel.connection.client.hostname = \ | ||
'socket://:foo@/var/run/redis.sock' | ||
|
@@ -1434,7 +1446,7 @@ def test_getting_master_from_sentinel(self): | |
min_other_sentinels=0, password=None, sentinel_kwargs=None, | ||
socket_connect_timeout=None, socket_keepalive=None, | ||
socket_keepalive_options=None, socket_timeout=None, | ||
retry_on_timeout=None) | ||
username=None, retry_on_timeout=None) | ||
|
||
master_for = patched.return_value.master_for | ||
master_for.assert_called() | ||
|
@@ -1457,7 +1469,7 @@ def test_getting_master_from_sentinel_single_node(self): | |
min_other_sentinels=0, password=None, sentinel_kwargs=None, | ||
socket_connect_timeout=None, socket_keepalive=None, | ||
socket_keepalive_options=None, socket_timeout=None, | ||
retry_on_timeout=None) | ||
username=None, retry_on_timeout=None) | ||
|
||
master_for = patched.return_value.master_for | ||
master_for.assert_called() | ||
|