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