summaryrefslogtreecommitdiff
path: root/tests/test_memcache.py
diff options
context:
space:
mode:
authorNicolas NoƩ <nicolas@niconoe.eu>2016-12-14 10:44:34 +0100
committerTim Graham <timograham@gmail.com>2017-11-21 13:37:56 -0500
commit0b47212f4f2f7584a840ab3978ccdfc8f8f4fd90 (patch)
tree11828bac6d417fe532120e47a5f791eebe24e80d /tests/test_memcache.py
parent4670752fa522d3e33db6b58a34033a3b89b9ee82 (diff)
downloadpython-memcached-0b47212f4f2f7584a840ab3978ccdfc8f8f4fd90.tar.gz
Fix touch(..., time=0) sending invalid command to memcache
Without the trailing '0', the command is invalid.
Diffstat (limited to 'tests/test_memcache.py')
-rw-r--r--tests/test_memcache.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_memcache.py b/tests/test_memcache.py
index b5f8884..40b6524 100644
--- a/tests/test_memcache.py
+++ b/tests/test_memcache.py
@@ -51,6 +51,13 @@ class TestMemcache(unittest.TestCase):
self.assertEqual(result, True)
self.assertEqual(self.mc.get("long"), None)
+ @mock.patch.object(_Host, 'send_cmd')
+ @mock.patch.object(_Host, 'readline')
+ def test_touch(self, mock_readline, mock_send_cmd):
+ with captured_stderr():
+ self.mc.touch('key')
+ mock_send_cmd.assert_called_with(b'touch key 0')
+
def test_get_multi(self):
self.check_setget("gm_a_string", "some random string")
self.check_setget("gm_an_integer", 42)