summaryrefslogtreecommitdiff
path: root/tests/test_commands.py
diff options
context:
space:
mode:
authordvora-h <67596500+dvora-h@users.noreply.github.com>2022-06-01 16:46:21 +0300
committerGitHub <noreply@github.com>2022-06-01 16:46:21 +0300
commit3081a32b3852276999bb250655e4dfe2c87c654c (patch)
tree50a0417796dd6fc8531167b69dc0aa0ff179b495 /tests/test_commands.py
parentfa0be7671de6be85f859cbb57a31531b2482c9e1 (diff)
downloadredis-py-3081a32b3852276999bb250655e4dfe2c87c654c.tar.gz
SHUTDOWN - add support for the new NOW, FORCE and ABORT modifiers (#2150)
* add support for NOW, FORCE and ABORT modifiers * linters * test * linters * test params * fix tests Co-authored-by: Chayim <chayim@users.noreply.github.com>
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 1ae6219..fcd2ed1 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -3,6 +3,7 @@ import datetime
import re
import time
from string import ascii_letters
+from unittest import mock
import pytest
@@ -4631,6 +4632,19 @@ class TestRedisCommands:
assert r.replicaof("NO ONE")
assert r.replicaof("NO", "ONE")
+ def test_shutdown(self, r: redis.Redis):
+ r.execute_command = mock.MagicMock()
+ r.execute_command("SHUTDOWN", "NOSAVE")
+ r.execute_command.assert_called_once_with("SHUTDOWN", "NOSAVE")
+
+ @skip_if_server_version_lt("7.0.0")
+ def test_shutdown_with_params(self, r: redis.Redis):
+ r.execute_command = mock.MagicMock()
+ r.execute_command("SHUTDOWN", "SAVE", "NOW", "FORCE")
+ r.execute_command.assert_called_once_with("SHUTDOWN", "SAVE", "NOW", "FORCE")
+ r.execute_command("SHUTDOWN", "ABORT")
+ r.execute_command.assert_called_with("SHUTDOWN", "ABORT")
+
@pytest.mark.replica
@skip_if_server_version_lt("2.8.0")
@skip_if_redis_enterprise()