summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordvora-h <dvora.heller@redis.com>2021-12-20 16:56:48 +0200
committerdvora-h <dvora.heller@redis.com>2021-12-20 16:56:48 +0200
commitb58cd9015a33aa39f04eb417e9e4496e2961efad (patch)
tree44b6949006da91d6a013dd27c4ac0d74e051efcd
parent58d383f01c0859c3ff76a2a9695cf7f1730d6075 (diff)
downloadredis-py-b58cd9015a33aa39f04eb417e9e4496e2961efad.tar.gz
fix test_set_path
-rw-r--r--tests/test_json.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/test_json.py b/tests/test_json.py
index 9faf0ae..8bd1d77 100644
--- a/tests/test_json.py
+++ b/tests/test_json.py
@@ -1416,18 +1416,18 @@ def test_set_file(client):
@pytest.mark.redismod
def test_set_path(client):
import json
- import os
import tempfile
root = tempfile.mkdtemp()
sub = tempfile.mkdtemp(dir=root)
- ospointer, jsonfile = tempfile.mkstemp(suffix=".json", dir=sub)
- ospointer2, nojsonfile = tempfile.mkstemp(dir=root)
+ jsonfile = tempfile.mktemp(suffix=".json", dir=sub)
+ nojsonfile = tempfile.mktemp(dir=root)
with open(jsonfile, "w+") as fp:
fp.write(json.dumps({"hello": "world"}))
open(nojsonfile, "a+").write("hello")
- result = {"/private" + jsonfile: True, "/private" + nojsonfile: False}
- assert client.json().set_path(Path.rootPath(), os.path.realpath(root)) == result
- assert client.json().get("/private" + jsonfile.rsplit(".")[0]) == {"hello": "world"}
+ result = {jsonfile: True, nojsonfile: False}
+ print(result)
+ assert client.json().set_path(Path.rootPath(), root) == result
+ assert client.json().get(jsonfile.rsplit(".")[0]) == {"hello": "world"}