1818@patch ('django.conf.settings' , global_settings )
1919@patch ('django_elastipymemcache.memcached.get_cluster_info' )
2020def test_split_servers (get_cluster_info ):
21- from django_elastipymemcache .memcached import ElastiPyMemCache
21+ from django_elastipymemcache .memcached import (
22+ ElastiPyMemCache ,
23+ deserialize_pickle ,
24+ )
2225 backend = ElastiPyMemCache ('h:0' , {})
2326 servers = [('h1' , 0 ), ('h2' , 0 )]
2427 get_cluster_info .return_value = {
@@ -28,13 +31,20 @@ def test_split_servers(get_cluster_info):
2831 assert backend ._cache
2932 get_cluster_info .assert_called_once_with (
3033 'h' , '0' , socket ._GLOBAL_DEFAULT_TIMEOUT )
31- backend ._lib .Client .assert_called_once_with (servers , ignore_exc = True )
34+ backend ._lib .Client .assert_called_once_with (
35+ servers ,
36+ deserializer = deserialize_pickle ,
37+ ignore_exc = True
38+ )
3239
3340
3441@patch ('django.conf.settings' , global_settings )
3542@patch ('django_elastipymemcache.memcached.get_cluster_info' )
3643def test_node_info_cache (get_cluster_info ):
37- from django_elastipymemcache .memcached import ElastiPyMemCache
44+ from django_elastipymemcache .memcached import (
45+ ElastiPyMemCache ,
46+ deserialize_pickle ,
47+ )
3848 servers = [('h1' , 0 ), ('h2' , 0 )]
3949 get_cluster_info .return_value = {
4050 'nodes' : servers
@@ -46,7 +56,11 @@ def test_node_info_cache(get_cluster_info):
4656 backend .get ('key1' )
4757 backend .set ('key2' , 'val' )
4858 backend .get ('key2' )
49- backend ._lib .Client .assert_called_once_with (servers , ignore_exc = True )
59+ backend ._lib .Client .assert_called_once_with (
60+ servers ,
61+ deserializer = deserialize_pickle ,
62+ ignore_exc = True
63+ )
5064 eq_ (backend ._cache .get .call_count , 2 )
5165 eq_ (backend ._cache .set .call_count , 2 )
5266
0 commit comments