Commit 575a0d2d authored by Jérome Perrin's avatar Jérome Perrin

remove quiet and run_all tests from signatures

replace self.getPoral() by self.portal


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35159 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 724794f2
...@@ -34,8 +34,6 @@ from Acquisition import aq_base ...@@ -34,8 +34,6 @@ from Acquisition import aq_base
class CodingStyleTestCase(ERP5TypeTestCase): class CodingStyleTestCase(ERP5TypeTestCase):
"""XXX """XXX
""" """
run_all_test = 1
quiet = 0
manager_username = 'zope' manager_username = 'zope'
manager_password = 'zope' manager_password = 'zope'
website_id = 'test' website_id = 'test'
...@@ -63,24 +61,18 @@ class CodingStyleTestCase(ERP5TypeTestCase): ...@@ -63,24 +61,18 @@ class CodingStyleTestCase(ERP5TypeTestCase):
return self.getBusinessTemplateList()[-1:] return self.getBusinessTemplateList()[-1:]
def afterSetUp(self): def afterSetUp(self):
portal = self.getPortal() portal = self.portal
uf = portal.acl_users uf = portal.acl_users
uf._doAddUser(self.manager_username, self.manager_password, ['Manager'], []) uf._doAddUser(self.manager_username, self.manager_password, ['Manager'], [])
self.login(self.manager_username) self.login(self.manager_username)
self.portal_id = self.portal.getId()
def test_01_SkinCodingStyle(self, quiet=quiet, run=run_all_test): def test_SkinCodingStyle(self):
""" """
Find all skin items of business templates to be checked Find all skin items of business templates to be checked
and gather all consistency messages. and gather all consistency messages.
""" """
if not run: return
if not quiet:
message = '\ntest_01_CodingStyle'
ZopeTestCase._print(message)
# Find the list if skins to test - we only test the last business template # Find the list if skins to test - we only test the last business template
portal_templates = self.getPortal().portal_templates portal_templates = self.getPortal().portal_templates
skin_id_list = [] skin_id_list = []
...@@ -92,7 +84,7 @@ class CodingStyleTestCase(ERP5TypeTestCase): ...@@ -92,7 +84,7 @@ class CodingStyleTestCase(ERP5TypeTestCase):
message_list = [] message_list = []
# Test skins # Test skins
portal_skins = self.getPortal().portal_skins portal_skins = self.portal.portal_skins
for skin_id in skin_id_list: for skin_id in skin_id_list:
skin = portal_skins[skin_id] skin = portal_skins[skin_id]
for document in skin.objectValues(): for document in skin.objectValues():
......
...@@ -26,12 +26,10 @@ ...@@ -26,12 +26,10 @@
# #
############################################################################## ##############################################################################
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.utils import installRealClassTool from Products.ERP5Type.tests.utils import installRealClassTool
from App.config import getConfiguration from App.config import getConfiguration
from zLOG import LOG
try: try:
from transaction import get as get_transaction from transaction import get as get_transaction
...@@ -40,49 +38,31 @@ except ImportError: ...@@ -40,49 +38,31 @@ except ImportError:
class TestClassTool(ERP5TypeTestCase): class TestClassTool(ERP5TypeTestCase):
run_all_test = 1
quiet = 1
def getTitle(self): def getTitle(self):
return "Class Tool" return "Class Tool"
def afterSetUp(self): def afterSetUp(self):
self.login() self.login()
installRealClassTool(self.getPortal()) installRealClassTool(self.portal)
def login(self, quiet=0, run=run_all_test): def login(self):
uf = self.getPortal().acl_users uf = self.portal.acl_users
uf._doAddUser('seb', '', ['Manager'], []) uf._doAddUser('seb', '', ['Manager'], [])
uf._doAddUser('ERP5TypeTestCase', '', ['Manager'], []) uf._doAddUser('ERP5TypeTestCase', '', ['Manager'], [])
user = uf.getUserById('seb').__of__(uf) user = uf.getUserById('seb').__of__(uf)
newSecurityManager(None, user) newSecurityManager(None, user)
def test_01_CheckClassTool(self, quiet=quiet, run=run_all_test): def test_01_CheckClassTool(self):
""" """
Make sure that portal_classes exists Make sure that portal_classes exists
""" """
if not run: portal = self.portal
return
if not quiet:
message = '\nCheck ClassTool '
ZopeTestCase._print(message)
LOG('Testing... ',0,message)
portal = self.getPortal()
self.assertNotEqual(None,getattr(portal,'portal_classes',None)) self.assertNotEqual(None,getattr(portal,'portal_classes',None))
get_transaction().commit() get_transaction().commit()
def test_02_CheckFileWriteIsTransactional(self, quiet=quiet, def test_02_CheckFileWriteIsTransactional(self):
run=run_all_test): portal = self.portal
if not run:
return
if not quiet:
message = '\nCheck File Transaction'
ZopeTestCase._print(message)
LOG('Testing... ',0,message)
portal = self.getPortal()
portal_classes = portal.portal_classes portal_classes = portal.portal_classes
self.assertEqual(portal_classes.getLocalDocumentList(), [], self.assertEqual(portal_classes.getLocalDocumentList(), [],
......
...@@ -29,18 +29,14 @@ ...@@ -29,18 +29,14 @@
import transaction import transaction
import unittest import unittest
import os
from Products.ERP5Type.tests.testERP5Type import PropertySheetTestCase from Products.ERP5Type.tests.testERP5Type import PropertySheetTestCase
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.Sequence import Sequence, SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
class TestConstraint(PropertySheetTestCase): class TestConstraint(PropertySheetTestCase):
run_all_test = 1
quiet = not os.environ.get('VERBOSE', 0)
object_portal_type = "Organisation" object_portal_type = "Organisation"
object_content_portal_type = "Address" object_content_portal_type = "Address"
object_title = "Title test" object_title = "Title test"
...@@ -305,11 +301,10 @@ class TestConstraint(PropertySheetTestCase): ...@@ -305,11 +301,10 @@ class TestConstraint(PropertySheetTestCase):
id='default_constraint', id='default_constraint',
description='constraint test') description='constraint test')
def test_01_Constraint(self, quiet=quiet, run=run_all_test): def test_01_Constraint(self):
""" """
Test default Constraint class Test default Constraint class
""" """
if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
# Test Constraint without any configuration # Test Constraint without any configuration
sequence_string = '\ sequence_string = '\
...@@ -319,7 +314,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -319,7 +314,7 @@ class TestConstraint(PropertySheetTestCase):
CheckIfConstraintSucceeded \ CheckIfConstraintSucceeded \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self)
def stepCreatePropertyExistence0(self, sequence=None, def stepCreatePropertyExistence0(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
...@@ -379,11 +374,10 @@ class TestConstraint(PropertySheetTestCase): ...@@ -379,11 +374,10 @@ class TestConstraint(PropertySheetTestCase):
description='propertyExistence test', description='propertyExistence test',
title=None) title=None)
def test_02_PropertyExistence(self, quiet=quiet, run=run_all_test): def test_02_PropertyExistence(self):
""" """
Test property existence Test property existence
""" """
if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
# Test Constraint without any configuration # Test Constraint without any configuration
sequence_string = '\ sequence_string = '\
...@@ -460,7 +454,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -460,7 +454,7 @@ class TestConstraint(PropertySheetTestCase):
CheckIfConstraintSucceeded \ CheckIfConstraintSucceeded \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self)
def stepCreatePropertyTypeValidity(self, sequence=None, def stepCreatePropertyTypeValidity(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
...@@ -472,11 +466,10 @@ class TestConstraint(PropertySheetTestCase): ...@@ -472,11 +466,10 @@ class TestConstraint(PropertySheetTestCase):
id='property_type_validity', id='property_type_validity',
description='propertyTypeValidity test') description='propertyTypeValidity test')
def test_03_PropertyTypeValidity(self, quiet=quiet, run=run_all_test): def test_03_PropertyTypeValidity(self):
""" """
Test property type validity Test property type validity
""" """
if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
# Test Constraint without any configuration # Test Constraint without any configuration
sequence_string = '\ sequence_string = '\
...@@ -561,7 +554,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -561,7 +554,7 @@ class TestConstraint(PropertySheetTestCase):
CheckIfConstraintSucceeded \ CheckIfConstraintSucceeded \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self)
def stepCreateAttributeEquality0(self, sequence=None, def stepCreateAttributeEquality0(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
...@@ -584,11 +577,10 @@ class TestConstraint(PropertySheetTestCase): ...@@ -584,11 +577,10 @@ class TestConstraint(PropertySheetTestCase):
description='AttributeEquality test', description='AttributeEquality test',
title=self.object_title) title=self.object_title)
def test_04_AttributeEquality(self, quiet=quiet, run=run_all_test): def test_04_AttributeEquality(self):
""" """
Test attribute equality Test attribute equality
""" """
if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
# Test Constraint without any configuration # Test Constraint without any configuration
sequence_string = '\ sequence_string = '\
...@@ -627,7 +619,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -627,7 +619,7 @@ class TestConstraint(PropertySheetTestCase):
CheckIfConstraintSucceeded \ CheckIfConstraintSucceeded \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self)
def stepCreateCategoryExistence0(self, sequence=None, def stepCreateCategoryExistence0(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
...@@ -673,11 +665,10 @@ class TestConstraint(PropertySheetTestCase): ...@@ -673,11 +665,10 @@ class TestConstraint(PropertySheetTestCase):
group=None, group=None,
portal_type = ('Organisation', )) portal_type = ('Organisation', ))
def test_05_CategoryExistence(self, quiet=quiet, run=run_all_test): def test_05_CategoryExistence(self):
""" """
Test category existence Test category existence
""" """
if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
# Test Constraint without any configuration # Test Constraint without any configuration
sequence_string = '\ sequence_string = '\
...@@ -743,7 +734,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -743,7 +734,7 @@ class TestConstraint(PropertySheetTestCase):
CheckIfConstraintSucceeded \ CheckIfConstraintSucceeded \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self)
def stepCreateCategoryMembershipArity0(self, sequence=None, def stepCreateCategoryMembershipArity0(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
...@@ -815,11 +806,10 @@ class TestConstraint(PropertySheetTestCase): ...@@ -815,11 +806,10 @@ class TestConstraint(PropertySheetTestCase):
portal_type=('Category', ), portal_type=('Category', ),
base_category=('group', )) base_category=('group', ))
def test_06_CategoryMembershipArity(self, quiet=quiet, run=run_all_test): def test_06_CategoryMembershipArity(self):
""" """
Test category existence Test category existence
""" """
if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
# Test Constraint with min=0, max=0 # Test Constraint with min=0, max=0
sequence_string = '\ sequence_string = '\
...@@ -966,7 +956,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -966,7 +956,7 @@ class TestConstraint(PropertySheetTestCase):
CheckIfConstraintSucceeded \ CheckIfConstraintSucceeded \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self)
def test_CategoryMembershipArityNoMax(self): def test_CategoryMembershipArityNoMax(self):
obj = self._makeOne() obj = self._makeOne()
...@@ -1041,11 +1031,10 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1041,11 +1031,10 @@ class TestConstraint(PropertySheetTestCase):
portal_type=('Organisation', ), portal_type=('Organisation', ),
base_category=('group', )) base_category=('group', ))
def test_07_CategoryRelatedMembershipArity(self, quiet=quiet, run=run_all_test): def test_07_CategoryRelatedMembershipArity(self):
""" """
Test related category existence Test related category existence
""" """
if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
# Test Constraint with min=0, max=0 # Test Constraint with min=0, max=0
sequence_string = '\ sequence_string = '\
...@@ -1110,7 +1099,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1110,7 +1099,7 @@ class TestConstraint(PropertySheetTestCase):
CheckIfConstraintFailed \ CheckIfConstraintFailed \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self)
def test_RelatedCategoryMembershipArityNoMax(self): def test_RelatedCategoryMembershipArityNoMax(self):
related_obj = self._makeOne() related_obj = self._makeOne()
...@@ -1304,12 +1293,10 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1304,12 +1293,10 @@ class TestConstraint(PropertySheetTestCase):
content_object = content_object, content_object = content_object,
) )
def test_ContentExistenceConstraint(self, quiet=quiet, run=run_all_test): def test_ContentExistenceConstraint(self):
""" """
Tests Content Existence Tests Content Existence
""" """
if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
# Test Constraint without any content # Test Constraint without any content
sequence_string = '\ sequence_string = '\
...@@ -1328,7 +1315,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1328,7 +1315,7 @@ class TestConstraint(PropertySheetTestCase):
CheckIfConstraintSucceeded \ CheckIfConstraintSucceeded \
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self)
def stepCreateStringAttributeMatch(self, sequence=None, sequence_list=None, **kw): def stepCreateStringAttributeMatch(self, sequence=None, sequence_list=None, **kw):
""" """
...@@ -1362,11 +1349,10 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1362,11 +1349,10 @@ class TestConstraint(PropertySheetTestCase):
object = object, object = object,
) )
def test_StringAttributeMatchConstraint(self, quiet=quiet, run=run_all_test): def test_StringAttributeMatchConstraint(self):
""" """
Tests Content Existence Tests string attribute match
""" """
if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
# Test Constraint with empty Title # Test Constraint with empty Title
sequence_string = '\ sequence_string = '\
...@@ -1396,7 +1382,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1396,7 +1382,7 @@ class TestConstraint(PropertySheetTestCase):
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self)
def test_RegisterWithPropertySheet(self): def test_RegisterWithPropertySheet(self):
# constraint are registred in property sheets # constraint are registred in property sheets
...@@ -1522,11 +1508,10 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1522,11 +1508,10 @@ class TestConstraint(PropertySheetTestCase):
condition="object/getTitle") condition="object/getTitle")
sequence.set('constraint', constraint) sequence.set('constraint', constraint)
def test_08_AttributeUnicity(self, quiet=quiet, run=run_all_test): def test_08_AttributeUnicity(self):
""" """
Test attribute unicity Test attribute unicity
""" """
if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
# Test Constraint without unicity on title # Test Constraint without unicity on title
sequence_string = '\ sequence_string = '\
...@@ -1560,7 +1545,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1560,7 +1545,7 @@ class TestConstraint(PropertySheetTestCase):
' '
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
This diff is collapsed.
...@@ -55,16 +55,16 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): ...@@ -55,16 +55,16 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor):
Executed before each test_*. Executed before each test_*.
""" """
self.login() self.login()
self.folder = self.getPortal().newContent(id='TestFolder', self.folder = self.portal.newContent(id='TestFolder',
portal_type='Folder') portal_type='Folder')
self.other_folder = self.getPortal().newContent( self.other_folder = self.portal.newContent(
id='OtherTestFolder', portal_type='Folder') id='OtherTestFolder', portal_type='Folder')
def beforeTearDown(self): def beforeTearDown(self):
""" """
Executed after each test_*. Executed after each test_*.
""" """
self.getPortal().manage_delObjects(ids=[self.folder.getId(), self.portal.manage_delObjects(ids=[self.folder.getId(),
self.other_folder.getId()]) self.other_folder.getId()])
clearCache() clearCache()
...@@ -74,27 +74,19 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): ...@@ -74,27 +74,19 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor):
""" """
return self.folder.newContent(portal_type='Folder') return self.folder.newContent(portal_type='Folder')
def test_01_folderType(self, quiet=0, run=1): def test_01_folderType(self):
""" """
Test if the present Folder class is the ERP5 version of Folder, not Test if the present Folder class is the ERP5 version of Folder, not
CMF's. CMF's.
""" """
if not run : return
if not quiet:
message = 'Test folderType value'
LOG('Testing... ', 0, message)
self.assertTrue(isinstance(self.getTypesTool()['Folder'], self.assertTrue(isinstance(self.getTypesTool()['Folder'],
ERP5TypeInformation)) ERP5TypeInformation))
def test_02_defaultGenerateNewId(self, quiet=0, run=1): def test_02_defaultGenerateNewId(self):
""" """
Test the default Id generation method. Test the default Id generation method.
Ids are incremented at content creation and start at 1. Ids are incremented at content creation and start at 1.
""" """
if not run : return
if not quiet:
message = 'Test default generateNewId'
LOG('Testing... ', 0, message)
# No id generator defined # No id generator defined
self.assertEquals(self.folder.getIdGenerator(), '') self.assertEquals(self.folder.getIdGenerator(), '')
self.assertEquals(len(self.folder), 0) self.assertEquals(len(self.folder), 0)
...@@ -103,14 +95,10 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): ...@@ -103,14 +95,10 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor):
obj = self.newContent() obj = self.newContent()
self.assertEquals(obj.getId(), '2') self.assertEquals(obj.getId(), '2')
def test_03_customGenerateNewId(self, quiet=0, run=1): def test_03_customGenerateNewId(self):
""" """
Test that id_generator property is honored. Test that id_generator property is honored.
""" """
if not run : return
if not quiet:
message = 'Test custom generateNewId'
LOG('Testing... ', 0, message)
id_generator_script_name = 'testIdGenerator' id_generator_script_name = 'testIdGenerator'
id_generator_id_list = ['first_id', 'second_id'] id_generator_id_list = ['first_id', 'second_id']
createZODBPythonScript(self.getPortal().portal_skins.erp5_core, createZODBPythonScript(self.getPortal().portal_skins.erp5_core,
......
...@@ -28,10 +28,8 @@ ...@@ -28,10 +28,8 @@
import unittest import unittest
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from zLOG import LOG
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.Tool.SessionTool import SESSION_CACHE_FACTORY from Products.ERP5Type.Tool.SessionTool import SESSION_CACHE_FACTORY
from string import letters as LETTERS from string import letters as LETTERS
...@@ -52,7 +50,6 @@ primitives_kw = dict(attr_1 = ['list_item'], \ ...@@ -52,7 +50,6 @@ primitives_kw = dict(attr_1 = ['list_item'], \
class TestSessionTool(ERP5TypeTestCase): class TestSessionTool(ERP5TypeTestCase):
run_all_test = 1
session_id = "123456789" session_id = "123456789"
def getTitle(self): def getTitle(self):
...@@ -75,7 +72,7 @@ class TestSessionTool(ERP5TypeTestCase): ...@@ -75,7 +72,7 @@ class TestSessionTool(ERP5TypeTestCase):
url_string='127.0.0.1:11211') url_string='127.0.0.1:11211')
self.login() self.login()
def login(self, quiet=0, run=run_all_test): def login(self):
uf = self.getPortal().acl_users uf = self.getPortal().acl_users
uf._doAddUser('ivan', '', ['Manager'], []) uf._doAddUser('ivan', '', ['Manager'], [])
uf._doAddUser('ERP5TypeTestCase', '', ['Manager'], []) uf._doAddUser('ERP5TypeTestCase', '', ['Manager'], [])
...@@ -267,26 +264,12 @@ class TestSessionTool(ERP5TypeTestCase): ...@@ -267,26 +264,12 @@ class TestSessionTool(ERP5TypeTestCase):
session = self.portal.portal_sessions[self.session_id] session = self.portal.portal_sessions[self.session_id]
self.assertEquals(session.get('key'), 'value') self.assertEquals(session.get('key'), 'value')
def test_01_CheckSessionTool(self, quiet=0, run=run_all_test): def test_01_CheckSessionTool(self):
""" Create portal_sessions tool and needed cache factory. """ """ Checks session tool is present """
if not run: self.assertNotEqual(None, getattr(self.portal, 'portal_sessions', None))
return
if not quiet:
message = '\nCheck SessionTool '
ZopeTestCase._print(message)
LOG('Testing... ',0,message)
portal = self.getPortal()
self.assertNotEqual(None, getattr(portal, 'portal_sessions', None))
def test_02_RamSession(self, quiet=0, run=run_all_test):
""" Test RamSession which uses local RAM based cache plugin. """
if not run:
return
if not quiet:
message = '\nTest Ram Session.'
ZopeTestCase._print(message)
LOG('Testing... ', 0, message)
def test_02_RamSession(self):
""" Test RamSession which uses local RAM based cache plugin. """
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = 'stepTestSetGet \ sequence_string = 'stepTestSetGet \
stepTestAcquisitionRamSessionStorage \ stepTestAcquisitionRamSessionStorage \
...@@ -301,15 +284,8 @@ class TestSessionTool(ERP5TypeTestCase): ...@@ -301,15 +284,8 @@ class TestSessionTool(ERP5TypeTestCase):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def test_03_MemcachedDistributedSession(self, quiet=0, run=run_all_test): def test_03_MemcachedDistributedSession(self):
""" Test DistributedSession which uses memcached based cache plugin. """ """ Test DistributedSession which uses memcached based cache plugin. """
if not run:
return
if not quiet:
message = '\nTest Distributed Session (memcached).'
ZopeTestCase._print(message)
LOG('Testing... ', 0, message)
# create memcached plugin and test # create memcached plugin and test
self._changeCachePlugin('Distributed Ram Cache') self._changeCachePlugin('Distributed Ram Cache')
sequence_list = SequenceList() sequence_list = SequenceList()
......
...@@ -41,8 +41,6 @@ class TestTimerService(ERP5TypeTestCase): ...@@ -41,8 +41,6 @@ class TestTimerService(ERP5TypeTestCase):
idea to put an ERP5-type test in it. idea to put an ERP5-type test in it.
""" """
run_all_test = 1
def getTitle(self): def getTitle(self):
return "TimerService" return "TimerService"
...@@ -51,34 +49,16 @@ class TestTimerService(ERP5TypeTestCase): ...@@ -51,34 +49,16 @@ class TestTimerService(ERP5TypeTestCase):
""" """
return () return ()
def login(self, quiet=0, run=run_all_test): def afterSetUp(self):
uf = self.getPortal().acl_users uf = self.portal.acl_users
uf._doAddUser('rc', '', ['Manager'], []) uf._doAddUser('rc', '', ['Manager'], [])
user = uf.getUserById('rc').__of__(uf) user = uf.getUserById('rc').__of__(uf)
newSecurityManager(None, user) newSecurityManager(None, user)
def enableLightInstall(self): def test_01_checkAnonymousProcessing(self):
"""
You can override this.
Return if we should do a light install (1) or not (0)
"""
return 1
def enableActivityTool(self):
"""
You can override this.
Return if we should create (1) or not (0) an activity tool.
"""
return 1
def afterSetUp(self, quiet=1):
self.login()
def test_01_checkAnonymousProcessing(self, quiet=0, run=run_all_test):
""" """
Test whether a timer can be invoked by anonymous. Test whether a timer can be invoked by anonymous.
""" """
if not run: return
noSecurityManager() noSecurityManager()
timer_service = self.app.Control_Panel.timer_service timer_service = self.app.Control_Panel.timer_service
process_timer = guarded_getattr(timer_service, 'process_timer') process_timer = guarded_getattr(timer_service, 'process_timer')
......
...@@ -28,9 +28,7 @@ ...@@ -28,9 +28,7 @@
import unittest import unittest
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG
from Products.ERP5Type.tests.utils import LogInterceptor from Products.ERP5Type.tests.utils import LogInterceptor
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
...@@ -40,9 +38,6 @@ except ImportError: ...@@ -40,9 +38,6 @@ except ImportError:
pass pass
class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor): class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor):
run_all_test = 1
quiet = 1
# Some helper methods # Some helper methods
def getTitle(self): def getTitle(self):
...@@ -57,16 +52,10 @@ class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor): ...@@ -57,16 +52,10 @@ class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor):
def afterSetUp(self): def afterSetUp(self):
self.login() self.login()
def test_01_DictInterface(self, quiet=quiet, run=run_all_test): def test_01_DictInterface(self):
"""Check if a transaction variable behaves in the same way as a dict. """Check if a transaction variable behaves in the same way as a dict. """
"""
if not run: return
if not quiet:
message = 'Test Dict Interface'
ZopeTestCase._print('\n '+message)
LOG('Testing... ', 0, message)
tv = getTransactionalVariable(self.getPortal()) tv = getTransactionalVariable(self.portal)
self.failIfEqual(tv, None) self.failIfEqual(tv, None)
# Test frequently used dict methods. This does not cover everything, # Test frequently used dict methods. This does not cover everything,
...@@ -89,17 +78,11 @@ class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor): ...@@ -89,17 +78,11 @@ class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor):
self.failIf('foo' in tv) self.failIf('foo' in tv)
self.failUnlessEqual(len(tv), 1) self.failUnlessEqual(len(tv), 1)
def test_02_Expiration(self, quiet=quiet, run=run_all_test): def test_02_Expiration(self):
"""Check if a transaction variable does not persist over multiple """Check if a transaction variable does not persist over multiple
transactions. transactions.
""" """
if not run: return tv = getTransactionalVariable(self.portal)
if not quiet:
message = 'Test Expiration'
ZopeTestCase._print('\n '+message)
LOG('Testing... ', 0, message)
tv = getTransactionalVariable(self.getPortal())
self.failIfEqual(tv, None) self.failIfEqual(tv, None)
tv.clear() tv.clear()
...@@ -117,17 +100,11 @@ class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor): ...@@ -117,17 +100,11 @@ class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor):
get_transaction().abort() get_transaction().abort()
self.failIf('toto' in tv) self.failIf('toto' in tv)
def test_03_Durability(self, quiet=quiet, run=run_all_test): def test_03_Durability(self):
"""Check if a transaction variable does not disappear within the same """Check if a transaction variable does not disappear within the same
transaction. transaction.
""" """
if not run: return tv = getTransactionalVariable(self.portal)
if not quiet:
message = 'Test Durability'
ZopeTestCase._print('\n '+message)
LOG('Testing... ', 0, message)
tv = getTransactionalVariable(self.getPortal())
self.failIfEqual(tv, None) self.failIfEqual(tv, None)
tv.clear() tv.clear()
......
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