diff options
author | dogukanteber <47397379+dogukanteber@users.noreply.github.com> | 2022-03-02 13:27:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-02 12:27:12 +0200 |
commit | c5d19b8571d2b15a29637f56a51b0da560072945 (patch) | |
tree | cd61e1a20bf0779c3aadbee77c8b2b1ab0c79d94 /tests/test_commands.py | |
parent | a77df17cf3c36444540f6bce793720e1ee06f1c7 (diff) | |
download | redis-py-c5d19b8571d2b15a29637f56a51b0da560072945.tar.gz |
Add support for AUTH (#1929)
* Add support for AUTH
* Fix linter error
* test fix
* fix test in cluster
Co-authored-by: Chayim <chayim@users.noreply.github.com>
Co-authored-by: Chayim I. Kirshen <c@kirshen.com>
Co-authored-by: dvora-h <dvora.heller@redis.com>
Diffstat (limited to 'tests/test_commands.py')
-rw-r--r-- | tests/test_commands.py | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/test_commands.py b/tests/test_commands.py index 5c32d5f..dc10cde 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -65,16 +65,32 @@ class TestResponseCallbacks: class TestRedisCommands: + def test_auth(self, r, request): + username = "redis-py-auth" + + def teardown(): + r.acl_deluser(username) + + request.addfinalizer(teardown) + + assert r.acl_setuser( + username, + enabled=True, + passwords=["+strong_password"], + commands=["+acl"], + ) + + assert r.auth(username=username, password="strong_password") is True + + with pytest.raises(exceptions.ResponseError): + r.auth(username=username, password="wrong_password") + def test_command_on_invalid_key_type(self, r): r.lpush("a", "1") with pytest.raises(redis.ResponseError): r["a"] # SERVER INFORMATION - def test_auth_not_implemented(self, r): - with pytest.raises(NotImplementedError): - r.auth() - @skip_if_server_version_lt("6.0.0") def test_acl_cat_no_category(self, r): categories = r.acl_cat() |