Refs #5133 -- Tested memcached connection closing after each request.

This commit is contained in:
Ed Morley 2016-09-02 09:33:59 +01:00 committed by Tim Graham
parent 5bd967e1c5
commit 3e935aec6d
1 changed files with 7 additions and 0 deletions

View File

@ -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(