diff options
author | Chayim I. Kirshen <c@kirshen.com> | 2021-11-09 10:57:20 +0200 |
---|---|---|
committer | Chayim I. Kirshen <c@kirshen.com> | 2021-11-09 10:57:20 +0200 |
commit | 0e73a4e510b62026164f85e35997e0d1e913e3a4 (patch) | |
tree | c41aa89b1a6d2aa3aaf7684b36b4a932c93881bd /tests/test_json.py | |
parent | bba75187931af84dd21c91bcf1b3bd422c9aed72 (diff) | |
download | redis-py-ck-jsonts-pipelines.tar.gz |
Migrating pipeline support for JSON and TSck-jsonts-pipelines
Diffstat (limited to 'tests/test_json.py')
-rw-r--r-- | tests/test_json.py | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/tests/test_json.py b/tests/test_json.py index 19b0c32..b3f38f7 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -275,16 +275,28 @@ def test_objlen(client): assert len(obj) == client.json().objlen("obj") -# @pytest.mark.pipeline -# @pytest.mark.redismod -# def test_pipelineshouldsucceed(client): -# p = client.json().pipeline() -# p.set("foo", Path.rootPath(), "bar") -# p.get("foo") -# p.delete("foo") -# assert [True, "bar", 1] == p.execute() -# assert client.keys() == [] -# assert client.get("foo") is None +@pytest.mark.pipeline +@pytest.mark.redismod +def test_json_commands_in_pipeline(client): + p = client.json().pipeline() + p.set("foo", Path.rootPath(), "bar") + p.get("foo") + p.delete("foo") + assert [True, "bar", 1] == p.execute() + assert client.keys() == [] + assert client.get("foo") is None + + # now with a true, json object + client.flushdb() + p = client.json().pipeline() + d = {"hello": "world", "oh": "snap"} + p.jsonset("foo", Path.rootPath(), d) + p.jsonget("foo") + p.exists("notarealkey") + p.delete("foo") + assert [True, d, 0, 1] == p.execute() + assert client.keys() == [] + assert client.get("foo") is None @pytest.mark.redismod |