diff options
author | Gábor Boros <gabor.brs@gmail.com> | 2021-07-08 23:27:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 23:27:05 +0200 |
commit | 2d036f54b67fd7b2a21749bec9b7b403eab56e40 (patch) | |
tree | 7eb802110d81e40b3ec70c1e3b7c821ec5292803 /t | |
parent | e5dbfed8ae9fb5e7d2d76be682517a9779137c77 (diff) | |
download | kombu-2d036f54b67fd7b2a21749bec9b7b403eab56e40.tar.gz |
Add support for setting redis username (#1351)
* feat: add support for setting redis username
* tests: add redis connparams credentials tests
Diffstat (limited to 't')
-rw-r--r-- | t/unit/transport/test_redis.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/t/unit/transport/test_redis.py b/t/unit/transport/test_redis.py index faa01f6d..5b1ed971 100644 --- a/t/unit/transport/test_redis.py +++ b/t/unit/transport/test_redis.py @@ -695,6 +695,18 @@ class test_Channel: 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:bar@127.0.0.1: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' @@ -1414,7 +1426,7 @@ class test_RedisSentinel: 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() @@ -1437,7 +1449,7 @@ class test_RedisSentinel: 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() |