diff options
author | dvora-h <dvora.heller@redis.com> | 2021-12-19 17:38:57 +0200 |
---|---|---|
committer | dvora-h <dvora.heller@redis.com> | 2021-12-19 17:38:57 +0200 |
commit | aa0c80906a58ce4f79b3251e095d1fe0b816cf15 (patch) | |
tree | 583a16aa7ca806db4907b80784e261b73ee917a3 /tests/test_json.py | |
parent | f82ab336c3e249ee871ee5e50e10c0de08c4f38a (diff) | |
download | redis-py-aa0c80906a58ce4f79b3251e095d1fe0b816cf15.tar.gz |
add set_file and set_path
Diffstat (limited to 'tests/test_json.py')
-rw-r--r-- | tests/test_json.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_json.py b/tests/test_json.py index a99547d..74b00ea 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -1392,3 +1392,15 @@ def test_custom_decoder(client): assert client.exists("foo") == 0 assert not isinstance(cj.__encoder__, json.JSONEncoder) assert not isinstance(cj.__decoder__, json.JSONDecoder) + + +@pytest.mark.redismod +def test_set_file(client): + import tempfile + import json + + jsonfile = tempfile.NamedTemporaryFile(suffix=".json") + with open(jsonfile.name, 'w+') as fp: + fp.write(json.dumps({"hello": "world"})) + + assert client.json().set("test", Path.rootPath(), jsonfile.name)
\ No newline at end of file |