diff options
author | Andy McCurdy <andy@andymccurdy.com> | 2020-06-08 12:58:25 -0700 |
---|---|---|
committer | Andy McCurdy <andy@andymccurdy.com> | 2020-06-08 12:58:25 -0700 |
commit | 7e466f7bee41d88e01d22e3a4c904e0e578630c9 (patch) | |
tree | c6036ee937f3672dc3dbfdb62397a51a377bdc8e /tests/test_monitor.py | |
parent | 2c9f41f46991f94f0626598600d1023d4e12f0bc (diff) | |
download | redis-py-7e466f7bee41d88e01d22e3a4c904e0e578630c9.tar.gz |
Do not un-escape \ characters when parsing MONITOR output
Prior to this, escaped slashes ("\\") were un-escaped. This caused the strings
"foo\x92" and "foo\\x92" to be represented the same way in the output.
Fixes #1349
Diffstat (limited to 'tests/test_monitor.py')
-rw-r--r-- | tests/test_monitor.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_monitor.py b/tests/test_monitor.py index 0e39ec0..ee5dc6e 100644 --- a/tests/test_monitor.py +++ b/tests/test_monitor.py @@ -34,6 +34,13 @@ class TestMonitor(object): response = wait_for_command(r, m, 'GET foo\\x92') assert response['command'] == 'GET foo\\x92' + def test_command_with_escaped_data(self, r): + with r.monitor() as m: + byte_string = b'foo\\x92' + r.get(byte_string) + response = wait_for_command(r, m, 'GET foo\\\\x92') + assert response['command'] == 'GET foo\\\\x92' + def test_lua_script(self, r): with r.monitor() as m: script = 'return redis.call("GET", "foo")' |