summaryrefslogtreecommitdiff
path: root/tests/cache
diff options
context:
space:
mode:
authorEd Morley <emorley@mozilla.com>2016-09-02 09:33:59 +0100
committerTim Graham <timograham@gmail.com>2016-09-02 14:36:36 -0400
commit3e935aec6d6c670b3e48425d60ec94fc96f5cdd6 (patch)
treecb4eb5515324e82a0adf8fc1e241d81130b6156c /tests/cache
parent5bd967e1c52bfe811daffaccd3ef8964f8a3cb35 (diff)
Refs #5133 -- Tested memcached connection closing after each request.
Diffstat (limited to 'tests/cache')
-rw-r--r--tests/cache/tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index 04c523e853..f9190ed55f 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -1239,6 +1239,13 @@ class BaseMemcachedTests(BaseCacheTests):
value = cache.get('small_value')
self.assertTrue(value is None or value == large_value)
+ def test_close(self):
+ # For clients that don't manage their connections properly, the
+ # connection is closed when the request is complete.
+ with mock.patch.object(cache._lib.Client, 'disconnect_all', autospec=True) as mock_disconnect:
+ signals.request_finished.send(self.__class__)
+ self.assertIs(mock_disconnect.called, True)
+
@unittest.skipUnless(MemcachedCache_params, "MemcachedCache backend not configured")
@override_settings(CACHES=caches_setting_for_tests(