Commit a97aacfd authored by Nicolas Delaby's avatar Nicolas Delaby

Update test according last changes

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27589 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5cfb89e7
# -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved.
...@@ -50,8 +51,10 @@ class TestRamCache(unittest.TestCase): ...@@ -50,8 +51,10 @@ class TestRamCache(unittest.TestCase):
def setUp(self): def setUp(self):
self.cache_plugins = (RamCache(), self.cache_plugins = (RamCache(),
DistributedRamCache({'server': '127.0.0.1:11211', DistributedRamCache({'server': '127.0.0.1:11211',
'debugLevel': 7,}), 'debug_level': 7,
) 'server_max_key_length': 250,
'server_max_value_length': 1048576,}),
)
def testScope(self): def testScope(self):
""" test scope functions """ """ test scope functions """
...@@ -167,7 +170,7 @@ class TestRamCache(unittest.TestCase): ...@@ -167,7 +170,7 @@ class TestRamCache(unittest.TestCase):
## check get() ## check get()
cache_entry = cache_plugin.get(cache_id, scope) cache_entry = cache_plugin.get(cache_id, scope)
if isinstance(value, Foo): if isinstance(value, Foo):
## with memcached, we have a new object created for user ## when memcached, we have a new object created for user
## just compare one field from it ## just compare one field from it
self.assertEqual(value.my_field, cache_entry.getValue().my_field) self.assertEqual(value.my_field, cache_entry.getValue().my_field)
else: else:
......
...@@ -55,7 +55,8 @@ class TestMemcachedTool(ERP5TypeTestCase): ...@@ -55,7 +55,8 @@ class TestMemcachedTool(ERP5TypeTestCase):
memcached_tool = self.getPortal().portal_memcached memcached_tool = self.getPortal().portal_memcached
#create Memcache Plugin #create Memcache Plugin
if getattr(memcached_tool, 'default_memcached_plugin', None) is None: if getattr(memcached_tool, 'default_memcached_plugin', None) is None:
memcached_tool.newContent(portal_type='Memcached Plugin', memcached_tool.newContent(id='default_memcached_plugin',
portal_type='Memcached Plugin',
int_index=0, int_index=0,
url_string='127.0.0.1:11211') url_string='127.0.0.1:11211')
transaction.commit() transaction.commit()
...@@ -71,7 +72,8 @@ class TestMemcachedTool(ERP5TypeTestCase): ...@@ -71,7 +72,8 @@ class TestMemcachedTool(ERP5TypeTestCase):
newSecurityManager(None, user) newSecurityManager(None, user)
def getMemcachedDict(self): def getMemcachedDict(self):
return self.getPortal().portal_memcached.getMemcachedDict(key_prefix='unit_test') return self.getPortal().portal_memcached.getMemcachedDict(key_prefix='unit_test',
plugin_path='portal_memcached/default_memcached_plugin')
def test_00_MemcachedToolIsEnabled(self): def test_00_MemcachedToolIsEnabled(self):
""" """
...@@ -87,11 +89,7 @@ class TestMemcachedTool(ERP5TypeTestCase): ...@@ -87,11 +89,7 @@ class TestMemcachedTool(ERP5TypeTestCase):
import memcache import memcache
except ImportError: except ImportError:
# MemcachedTool should be disabled # MemcachedTool should be disabled
self.assertRaises(RuntimeError, memcached_tool.getServerAddressList) self.assertRaises(RuntimeError, memcached_tool.getMemcachedDict)
else:
# MemcachedTool should be enabled
self.assertTrue(isinstance(memcached_tool.getServerAddressList(),
list))
def test_01_dictionnaryIsUsable(self): def test_01_dictionnaryIsUsable(self):
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment