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+ serialize_pickle ,
25+ )
2226 backend = ElastiPyMemCache ('h:0' , {})
2327 servers = [('h1' , 0 ), ('h2' , 0 )]
2428 get_cluster_info .return_value = {
@@ -28,13 +32,22 @@ def test_split_servers(get_cluster_info):
2832 assert backend ._cache
2933 get_cluster_info .assert_called_once_with (
3034 'h' , '0' , socket ._GLOBAL_DEFAULT_TIMEOUT )
31- backend ._lib .Client .assert_called_once_with (servers , ignore_exc = True )
35+ backend ._lib .Client .assert_called_once_with (
36+ servers ,
37+ deserializer = deserialize_pickle ,
38+ ignore_exc = True ,
39+ serializer = serialize_pickle
40+ )
3241
3342
3443@patch ('django.conf.settings' , global_settings )
3544@patch ('django_elastipymemcache.memcached.get_cluster_info' )
3645def test_node_info_cache (get_cluster_info ):
37- from django_elastipymemcache .memcached import ElastiPyMemCache
46+ from django_elastipymemcache .memcached import (
47+ ElastiPyMemCache ,
48+ deserialize_pickle ,
49+ serialize_pickle ,
50+ )
3851 servers = [('h1' , 0 ), ('h2' , 0 )]
3952 get_cluster_info .return_value = {
4053 'nodes' : servers
@@ -46,7 +59,12 @@ def test_node_info_cache(get_cluster_info):
4659 backend .get ('key1' )
4760 backend .set ('key2' , 'val' )
4861 backend .get ('key2' )
49- backend ._lib .Client .assert_called_once_with (servers , ignore_exc = True )
62+ backend ._lib .Client .assert_called_once_with (
63+ servers ,
64+ deserializer = deserialize_pickle ,
65+ ignore_exc = True ,
66+ serializer = serialize_pickle
67+ )
5068 eq_ (backend ._cache .get .call_count , 2 )
5169 eq_ (backend ._cache .set .call_count , 2 )
5270
0 commit comments