summaryrefslogtreecommitdiff
path: root/tests/test_commands.py
diff options
context:
space:
mode:
authorKamyab Taghizadeh <kamyab.zad@gmail.com>2022-04-28 04:06:05 +0430
committerGitHub <noreply@github.com>2022-04-28 02:36:05 +0300
commitcfebc0fa9c4f7e4ef141729959cd149861cfd706 (patch)
tree535b63b5538df5b221b86c4b2aac93a8ac91eff4 /tests/test_commands.py
parent1f046ac23502521dad280a49ff31263b2e92f4b3 (diff)
downloadredis-py-cfebc0fa9c4f7e4ef141729959cd149861cfd706.tar.gz
Fix incorrect return statement in auth (#2086) (#2092)
Diffstat (limited to 'tests/test_commands.py')
-rw-r--r--tests/test_commands.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 64fd87c..c8edd57 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -67,9 +67,23 @@ class TestResponseCallbacks:
class TestRedisCommands:
@skip_if_redis_enterprise()
def test_auth(self, r, request):
+ # first, test for default user (`username` is supposed to be optional)
+ default_username = "default"
+ temp_pass = "temp_pass"
+ r.config_set("requirepass", temp_pass)
+
+ assert r.auth(temp_pass, default_username) is True
+ assert r.auth(temp_pass) is True
+
+ # test for other users
username = "redis-py-auth"
def teardown():
+ try:
+ r.auth(temp_pass)
+ except exceptions.ResponseError:
+ r.auth("default", "")
+ r.config_set("requirepass", "")
r.acl_deluser(username)
request.addfinalizer(teardown)