summaryrefslogtreecommitdiff
path: root/tests/test_commands.py
diff options
context:
space:
mode:
authorSimon Charette <charettes@users.noreply.github.com>2020-11-22 15:52:44 -0500
committerGitHub <noreply@github.com>2020-11-22 12:52:44 -0800
commit1a41cfd95a53a95b078084d8627be6b6fba3bb71 (patch)
tree0a3d504b1f61192b17075a733429a9533e6b404f /tests/test_commands.py
parent8c176cdc7f36e2cbcd3254768766035a7b7cd8b3 (diff)
downloadredis-py-1a41cfd95a53a95b078084d8627be6b6fba3bb71.tar.gz
Add support for the ABSTTL option of the RESTORE command. (#1423)
Add support for the ABSTTL option of the RESTORE command.
Diffstat (limited to 'tests/test_commands.py')
-rw-r--r--tests/test_commands.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 2113078..d1f85b7 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -642,6 +642,19 @@ class TestRedisCommands:
r.restore('a', 0, dumped, replace=True)
assert r['a'] == b'bar'
+ @skip_if_server_version_lt('5.0.0')
+ def test_dump_and_restore_absttl(self, r):
+ r['a'] = 'foo'
+ dumped = r.dump('a')
+ del r['a']
+ ttl = int(
+ (redis_server_time(r) + datetime.timedelta(minutes=1)).timestamp()
+ * 1000
+ )
+ r.restore('a', ttl, dumped, absttl=True)
+ assert r['a'] == b'foo'
+ assert 0 < r.ttl('a') <= 61
+
def test_exists(self, r):
assert r.exists('a') == 0
r['a'] = 'foo'