Commit b6a7b3b8 authored by Jérome Perrin's avatar Jérome Perrin

indentation problem, test only run if quiet is false


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17523 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9331e8e4
...@@ -65,22 +65,22 @@ class TestSessionTool(ERP5TypeTestCase): ...@@ -65,22 +65,22 @@ class TestSessionTool(ERP5TypeTestCase):
message = '\nCheck SessionTool ' message = '\nCheck SessionTool '
ZopeTestCase._print(message) ZopeTestCase._print(message)
LOG('Testing... ',0,message) LOG('Testing... ',0,message)
portal = self.getPortal() portal = self.getPortal()
portal_caches = portal.portal_caches portal_caches = portal.portal_caches
portal.manage_addProduct['ERP5Type'].manage_addTool('ERP5 Session Tool') portal.manage_addProduct['ERP5Type'].manage_addTool('ERP5 Session Tool')
self.assertNotEqual(None,getattr(portal, 'portal_sessions', None)) self.assertNotEqual(None,getattr(portal, 'portal_sessions', None))
## create needed cache fatory for Session Tool ## create needed cache fatory for Session Tool
session_cache_factory = portal_caches.newContent(portal_type="Cache Factory", \ session_cache_factory = portal_caches.newContent(portal_type="Cache Factory", \
id = 'erp5_session_cache') id = 'erp5_session_cache')
session_cache_factory.setCacheDuration(36000) session_cache_factory.setCacheDuration(36000)
ram_cache_plugin = session_cache_factory.newContent(portal_type="Ram Cache") ram_cache_plugin = session_cache_factory.newContent(portal_type="Ram Cache")
ram_cache_plugin.setCacheDuration(36000) ram_cache_plugin.setCacheDuration(36000)
ram_cache_plugin.setIntIndex(0) ram_cache_plugin.setIntIndex(0)
## update Ram Cache structure ## update Ram Cache structure
portal_caches.updateCache() portal_caches.updateCache()
get_transaction().commit() get_transaction().commit()
def test_02_CreateSessionObject(self, quiet=0, run=run_all_test): def test_02_CreateSessionObject(self, quiet=0, run=run_all_test):
""" Create a session object and check if API (newContent) is properly working. """ Create a session object and check if API (newContent) is properly working.
...@@ -91,28 +91,28 @@ class TestSessionTool(ERP5TypeTestCase): ...@@ -91,28 +91,28 @@ class TestSessionTool(ERP5TypeTestCase):
message = '\nCreate of session object and assign attributes.' message = '\nCreate of session object and assign attributes.'
ZopeTestCase._print(message) ZopeTestCase._print(message)
LOG('Testing... ',0,message) LOG('Testing... ',0,message)
portal = self.getPortal() portal = self.getPortal()
portal_sessions = portal.portal_sessions portal_sessions = portal.portal_sessions
session = portal_sessions.newContent( session = portal_sessions.newContent(
self.session_id, \ self.session_id, \
attr_1 = newTempOrder(portal_sessions, '1'), \ attr_1 = newTempOrder(portal_sessions, '1'), \
attr_2 = newTempOrder(portal_sessions, '2'), \ attr_2 = newTempOrder(portal_sessions, '2'), \
attr_3 = 1, attr_3 = 1,
attr_4 = 0.1, attr_4 = 0.1,
attr_5 = {}, attr_5 = {},
attr_6 = 'string',) attr_6 = 'string',)
## check temp (RAM based) attributes stored in session ## check temp (RAM based) attributes stored in session
for i in range (1, 3): for i in range (1, 3):
attr_name = 'attr_%s' %i attr_name = 'attr_%s' %i
self.assert_(attr_name in session.keys()) self.assert_(attr_name in session.keys())
attr = session[attr_name] attr = session[attr_name]
self.assert_(str(i), attr.getId()) self.assert_(str(i), attr.getId())
self.assert_(0 == len(attr.objectIds())) self.assert_(0 == len(attr.objectIds()))
## check primitive stype storage ## check primitive stype storage
self.assert_(1 == session['attr_3']) self.assert_(1 == session['attr_3'])
self.assert_(0.1 == session['attr_4']) self.assert_(0.1 == session['attr_4'])
self.assert_({} == session['attr_5']) self.assert_({} == session['attr_5'])
self.assert_('string' == session['attr_6']) self.assert_('string' == session['attr_6'])
def test_03_DeleteSessionObjectAttributes(self, quiet=0, run=run_all_test): def test_03_DeleteSessionObjectAttributes(self, quiet=0, run=run_all_test):
...@@ -123,13 +123,13 @@ class TestSessionTool(ERP5TypeTestCase): ...@@ -123,13 +123,13 @@ class TestSessionTool(ERP5TypeTestCase):
message = '\nDelete some session keys.' message = '\nDelete some session keys.'
ZopeTestCase._print(message) ZopeTestCase._print(message)
LOG('Testing... ',0,message) LOG('Testing... ',0,message)
portal = self.getPortal() portal = self.getPortal()
portal_sessions = portal.portal_sessions portal_sessions = portal.portal_sessions
session = portal_sessions[self.session_id] session = portal_sessions[self.session_id]
session.pop('attr_1') session.pop('attr_1')
session.pop('attr_2') session.pop('attr_2')
self.assert_(not 'attr_1' in session.keys()) self.assert_(not 'attr_1' in session.keys())
self.assert_(not 'attr_2' in session.keys()) self.assert_(not 'attr_2' in session.keys())
def test_04_DeleteSessionObject(self, quiet=0, run=run_all_test): def test_04_DeleteSessionObject(self, quiet=0, run=run_all_test):
""" Get session object and check keys stored in previous test. """ """ Get session object and check keys stored in previous test. """
...@@ -139,12 +139,12 @@ class TestSessionTool(ERP5TypeTestCase): ...@@ -139,12 +139,12 @@ class TestSessionTool(ERP5TypeTestCase):
message = '\nDelete session object.' message = '\nDelete session object.'
ZopeTestCase._print(message) ZopeTestCase._print(message)
LOG('Testing... ',0,message) LOG('Testing... ',0,message)
portal = self.getPortal() portal = self.getPortal()
portal_sessions = portal.portal_sessions portal_sessions = portal.portal_sessions
## delete it ## delete it
portal_sessions.manage_delObjects(self.session_id) portal_sessions.manage_delObjects(self.session_id)
session = portal_sessions[self.session_id] session = portal_sessions[self.session_id]
self.assert_(0 == len(session.keys())) self.assert_(0 == len(session.keys()))
def test_session_dict_interface(self): def test_session_dict_interface(self):
session = self.portal.portal_sessions[self.session_id] session = self.portal.portal_sessions[self.session_id]
......
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