diff --git a/product/ERP5Type/tests/CodingStyleTestCase.py b/product/ERP5Type/tests/CodingStyleTestCase.py index bc010a4c823fba36c2649f77b2f70f3d96b2045c..b245e108c81653567f99165bfcde48116b8b9c0d 100644 --- a/product/ERP5Type/tests/CodingStyleTestCase.py +++ b/product/ERP5Type/tests/CodingStyleTestCase.py @@ -34,8 +34,6 @@ from Acquisition import aq_base class CodingStyleTestCase(ERP5TypeTestCase): """XXX """ - run_all_test = 1 - quiet = 0 manager_username = 'zope' manager_password = 'zope' website_id = 'test' @@ -63,24 +61,18 @@ class CodingStyleTestCase(ERP5TypeTestCase): return self.getBusinessTemplateList()[-1:] def afterSetUp(self): - portal = self.getPortal() + portal = self.portal uf = portal.acl_users uf._doAddUser(self.manager_username, self.manager_password, ['Manager'], []) 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 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 portal_templates = self.getPortal().portal_templates skin_id_list = [] @@ -92,7 +84,7 @@ class CodingStyleTestCase(ERP5TypeTestCase): message_list = [] # Test skins - portal_skins = self.getPortal().portal_skins + portal_skins = self.portal.portal_skins for skin_id in skin_id_list: skin = portal_skins[skin_id] for document in skin.objectValues(): diff --git a/product/ERP5Type/tests/testClassTool.py b/product/ERP5Type/tests/testClassTool.py index 72e86109b7bd2453fff78bcba3f513bcd4bb170b..99e44674976a299b4f8da98ddb0805a3cb253fe4 100644 --- a/product/ERP5Type/tests/testClassTool.py +++ b/product/ERP5Type/tests/testClassTool.py @@ -26,12 +26,10 @@ # ############################################################################## -from Testing import ZopeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from AccessControl.SecurityManagement import newSecurityManager from Products.ERP5Type.tests.utils import installRealClassTool from App.config import getConfiguration -from zLOG import LOG try: from transaction import get as get_transaction @@ -39,50 +37,32 @@ except ImportError: pass class TestClassTool(ERP5TypeTestCase): - - run_all_test = 1 - quiet = 1 def getTitle(self): return "Class Tool" def afterSetUp(self): self.login() - installRealClassTool(self.getPortal()) + installRealClassTool(self.portal) - def login(self, quiet=0, run=run_all_test): - uf = self.getPortal().acl_users + def login(self): + uf = self.portal.acl_users uf._doAddUser('seb', '', ['Manager'], []) uf._doAddUser('ERP5TypeTestCase', '', ['Manager'], []) user = uf.getUserById('seb').__of__(uf) 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 """ - if not run: - return - if not quiet: - message = '\nCheck ClassTool ' - ZopeTestCase._print(message) - LOG('Testing... ',0,message) - - portal = self.getPortal() + portal = self.portal self.assertNotEqual(None,getattr(portal,'portal_classes',None)) get_transaction().commit() - def test_02_CheckFileWriteIsTransactional(self, quiet=quiet, - run=run_all_test): - if not run: - return - if not quiet: - message = '\nCheck File Transaction' - ZopeTestCase._print(message) - LOG('Testing... ',0,message) - - portal = self.getPortal() + def test_02_CheckFileWriteIsTransactional(self): + portal = self.portal portal_classes = portal.portal_classes self.assertEqual(portal_classes.getLocalDocumentList(), [], diff --git a/product/ERP5Type/tests/testConstraint.py b/product/ERP5Type/tests/testConstraint.py index 110f0e5693072f5e083d222ddcad1c62507363b4..22b58834c8102fa0bb90ffa0bf59ee4b9b299b4d 100644 --- a/product/ERP5Type/tests/testConstraint.py +++ b/product/ERP5Type/tests/testConstraint.py @@ -29,18 +29,14 @@ import transaction import unittest -import os from Products.ERP5Type.tests.testERP5Type import PropertySheetTestCase from AccessControl.SecurityManagement import newSecurityManager -from Products.ERP5Type.tests.Sequence import Sequence, SequenceList +from Products.ERP5Type.tests.Sequence import SequenceList class TestConstraint(PropertySheetTestCase): - run_all_test = 1 - quiet = not os.environ.get('VERBOSE', 0) - object_portal_type = "Organisation" object_content_portal_type = "Address" object_title = "Title test" @@ -305,11 +301,10 @@ class TestConstraint(PropertySheetTestCase): id='default_constraint', description='constraint test') - def test_01_Constraint(self, quiet=quiet, run=run_all_test): + def test_01_Constraint(self): """ Test default Constraint class """ - if not run: return sequence_list = SequenceList() # Test Constraint without any configuration sequence_string = '\ @@ -319,7 +314,7 @@ class TestConstraint(PropertySheetTestCase): CheckIfConstraintSucceeded \ ' sequence_list.addSequenceString(sequence_string) - sequence_list.play(self, quiet=quiet) + sequence_list.play(self) def stepCreatePropertyExistence0(self, sequence=None, sequence_list=None, **kw): @@ -379,11 +374,10 @@ class TestConstraint(PropertySheetTestCase): description='propertyExistence test', title=None) - def test_02_PropertyExistence(self, quiet=quiet, run=run_all_test): + def test_02_PropertyExistence(self): """ Test property existence """ - if not run: return sequence_list = SequenceList() # Test Constraint without any configuration sequence_string = '\ @@ -460,7 +454,7 @@ class TestConstraint(PropertySheetTestCase): CheckIfConstraintSucceeded \ ' sequence_list.addSequenceString(sequence_string) - sequence_list.play(self, quiet=quiet) + sequence_list.play(self) def stepCreatePropertyTypeValidity(self, sequence=None, sequence_list=None, **kw): @@ -472,11 +466,10 @@ class TestConstraint(PropertySheetTestCase): id='property_type_validity', description='propertyTypeValidity test') - def test_03_PropertyTypeValidity(self, quiet=quiet, run=run_all_test): + def test_03_PropertyTypeValidity(self): """ Test property type validity """ - if not run: return sequence_list = SequenceList() # Test Constraint without any configuration sequence_string = '\ @@ -561,7 +554,7 @@ class TestConstraint(PropertySheetTestCase): CheckIfConstraintSucceeded \ ' sequence_list.addSequenceString(sequence_string) - sequence_list.play(self, quiet=quiet) + sequence_list.play(self) def stepCreateAttributeEquality0(self, sequence=None, sequence_list=None, **kw): @@ -584,11 +577,10 @@ class TestConstraint(PropertySheetTestCase): description='AttributeEquality test', title=self.object_title) - def test_04_AttributeEquality(self, quiet=quiet, run=run_all_test): + def test_04_AttributeEquality(self): """ Test attribute equality """ - if not run: return sequence_list = SequenceList() # Test Constraint without any configuration sequence_string = '\ @@ -627,7 +619,7 @@ class TestConstraint(PropertySheetTestCase): CheckIfConstraintSucceeded \ ' sequence_list.addSequenceString(sequence_string) - sequence_list.play(self, quiet=quiet) + sequence_list.play(self) def stepCreateCategoryExistence0(self, sequence=None, sequence_list=None, **kw): @@ -673,11 +665,10 @@ class TestConstraint(PropertySheetTestCase): group=None, portal_type = ('Organisation', )) - def test_05_CategoryExistence(self, quiet=quiet, run=run_all_test): + def test_05_CategoryExistence(self): """ Test category existence """ - if not run: return sequence_list = SequenceList() # Test Constraint without any configuration sequence_string = '\ @@ -743,7 +734,7 @@ class TestConstraint(PropertySheetTestCase): CheckIfConstraintSucceeded \ ' sequence_list.addSequenceString(sequence_string) - sequence_list.play(self, quiet=quiet) + sequence_list.play(self) def stepCreateCategoryMembershipArity0(self, sequence=None, sequence_list=None, **kw): @@ -815,11 +806,10 @@ class TestConstraint(PropertySheetTestCase): portal_type=('Category', ), base_category=('group', )) - def test_06_CategoryMembershipArity(self, quiet=quiet, run=run_all_test): + def test_06_CategoryMembershipArity(self): """ Test category existence """ - if not run: return sequence_list = SequenceList() # Test Constraint with min=0, max=0 sequence_string = '\ @@ -966,7 +956,7 @@ class TestConstraint(PropertySheetTestCase): CheckIfConstraintSucceeded \ ' sequence_list.addSequenceString(sequence_string) - sequence_list.play(self, quiet=quiet) + sequence_list.play(self) def test_CategoryMembershipArityNoMax(self): obj = self._makeOne() @@ -1041,11 +1031,10 @@ class TestConstraint(PropertySheetTestCase): portal_type=('Organisation', ), base_category=('group', )) - def test_07_CategoryRelatedMembershipArity(self, quiet=quiet, run=run_all_test): + def test_07_CategoryRelatedMembershipArity(self): """ Test related category existence """ - if not run: return sequence_list = SequenceList() # Test Constraint with min=0, max=0 sequence_string = '\ @@ -1110,7 +1099,7 @@ class TestConstraint(PropertySheetTestCase): CheckIfConstraintFailed \ ' sequence_list.addSequenceString(sequence_string) - sequence_list.play(self, quiet=quiet) + sequence_list.play(self) def test_RelatedCategoryMembershipArityNoMax(self): related_obj = self._makeOne() @@ -1304,12 +1293,10 @@ class TestConstraint(PropertySheetTestCase): content_object = content_object, ) - def test_ContentExistenceConstraint(self, quiet=quiet, run=run_all_test): + def test_ContentExistenceConstraint(self): """ Tests Content Existence """ - - if not run: return sequence_list = SequenceList() # Test Constraint without any content sequence_string = '\ @@ -1328,7 +1315,7 @@ class TestConstraint(PropertySheetTestCase): CheckIfConstraintSucceeded \ ' sequence_list.addSequenceString(sequence_string) - sequence_list.play(self, quiet=quiet) + sequence_list.play(self) def stepCreateStringAttributeMatch(self, sequence=None, sequence_list=None, **kw): """ @@ -1362,11 +1349,10 @@ class TestConstraint(PropertySheetTestCase): 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() # Test Constraint with empty Title sequence_string = '\ @@ -1396,7 +1382,7 @@ class TestConstraint(PropertySheetTestCase): ' sequence_list.addSequenceString(sequence_string) - sequence_list.play(self, quiet=quiet) + sequence_list.play(self) def test_RegisterWithPropertySheet(self): # constraint are registred in property sheets @@ -1522,11 +1508,10 @@ class TestConstraint(PropertySheetTestCase): condition="object/getTitle") sequence.set('constraint', constraint) - def test_08_AttributeUnicity(self, quiet=quiet, run=run_all_test): + def test_08_AttributeUnicity(self): """ Test attribute unicity """ - if not run: return sequence_list = SequenceList() # Test Constraint without unicity on title sequence_string = '\ @@ -1560,7 +1545,7 @@ class TestConstraint(PropertySheetTestCase): ' sequence_list.addSequenceString(sequence_string) - sequence_list.play(self, quiet=quiet) + sequence_list.play(self) def test_suite(): suite = unittest.TestSuite() diff --git a/product/ERP5Type/tests/testERP5Type.py b/product/ERP5Type/tests/testERP5Type.py index 5e44c49ad0a54c5aefc64b2a766edaaf12b767da..b72cce460ac4b60161f418b0e685859ca4a074e0 100644 --- a/product/ERP5Type/tests/testERP5Type.py +++ b/product/ERP5Type/tests/testERP5Type.py @@ -34,10 +34,9 @@ import sys import transaction from random import randint from Acquisition import aq_base -from Testing import ZopeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.utils import DummyLocalizer -from zLOG import LOG, INFO +from zLOG import INFO from Products.CMFCore.Expression import Expression from Products.ERP5Type.tests.utils import LogInterceptor from Products.CMFCore.WorkflowCore import WorkflowException @@ -102,9 +101,6 @@ class %(property_sheet_name)s: class TestERP5Type(PropertySheetTestCase, LogInterceptor): """Tests ERP5TypeInformation and per portal type generated accessors. """ - run_all_test = 1 - quiet = 1 - # Some helper methods def getTitle(self): @@ -137,8 +133,8 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): transaction.commit() self.tic() - def loginWithNoRole(self, quiet=0, run=run_all_test): - uf = self.getPortal().acl_users + def loginWithNoRole(self): + uf = self.portal.acl_users uf._doAddUser('ac', '', [], []) user = uf.getUserById('ac').__of__(uf) newSecurityManager(None, user) @@ -194,9 +190,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.assertEquals(business_template.getTitle(), test_string) # Test Dynamic Code Generation - def test_02_AqDynamic(self, quiet=quiet, run=run_all_test): - if not run: return - portal = self.getPortal() + def test_02_AqDynamic(self): module = self.getPersonModule() person = module.newContent(id='1', portal_type='Person') from Products.ERP5Type import Document @@ -210,9 +204,8 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): # Person class should now have method getFirstName self.assertTrue(hasattr(person, 'getFirstName')) - def test_03_NewTempObject(self, quiet=quiet, run=run_all_test): - if not run: return - portal = self.getPortal() + def test_03_NewTempObject(self): + portal = self.portal from Products.ERP5Type.Document import newTempPerson o = newTempPerson(portal, 1.2) @@ -227,12 +220,12 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.assertEquals(str(o.getId()), str(-123)) # Try to edit with any property and then get it with getProperty - o = newTempOrganisation(portal,'a') + o = newTempOrganisation(portal,'a') o.edit(tutu='toto') self.assertEquals(o.getProperty('tutu'), 'toto') # Same thing with an integer - o = newTempOrganisation(portal,'b') + o = newTempOrganisation(portal,'b') o.edit(tata=123) self.assertEquals(o.getProperty('tata'), 123) @@ -240,7 +233,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.assertEquals(o.isTempObject(), 1) # Create a subobject and make sure it is a Temp Object - a = o.newContent(portal_type = 'Telephone') + a = o.newContent(portal_type = 'Telephone') self.assertEquals(a.isTempObject(), 1) # Test newContent with the temp_object parameter @@ -333,7 +326,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.portal.portal_url.getRelativeContentPath(child11)) - def test_04_CategoryAccessors(self, quiet=quiet, run=run_all_test): + def test_04_CategoryAccessors(self): """ This test provides basic testing of category accessors using the region base category. @@ -354,8 +347,6 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): of a region and should thus be accessible from the region category through getRegionRelated accessors """ - if not run: return - portal = self.getPortal() region_category = self.getPortal().portal_categories.region category_title = "Solar System" @@ -435,7 +426,7 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.assertTrue(person_object.hasActivity()) self.tic() - def test_05_setProperty(self, quiet=quiet, run=run_all_test): + def test_05_setProperty(self): """ In this test we create a subobject (ie. a phone number) and show the difference between calling getProperty and @@ -451,8 +442,6 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): using getProperty / setProperty as a generic way to use accessors from subobjects. """ - if not run: return - portal = self.getPortal() module = self.getOrganisationModule() organisation = module.newContent(id='1', portal_type='Organisation') organisation.setDefaultTelephoneText('+55(0)66-5555') @@ -467,9 +456,8 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.assertEquals(organisation.default_telephone.corporate_name,'Toto') self.assertEquals(organisation.default_telephone.getProperty('corporate_name'),'Toto') - def test_06_CachingMethod(self, quiet=quiet, run=run_all_test): + def test_06_CachingMethod(self): """Tests Caching methods.""" - if not run: return cached_var = cached_var_orig = 'cached_var1' def _cache(): @@ -488,11 +476,10 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): clearCache() self.assertEquals(cache(), cached_var) - def test_07_afterCloneScript(self, quiet=quiet, run=run_all_test): + def test_07_afterCloneScript(self): """manage_afterClone can call a type based script.""" - if not run: return # setup the script for Person portal type - custom_skin = self.getPortal().portal_skins.custom + custom_skin = self.portal.portal_skins.custom method_id = 'Person_afterClone' if method_id in custom_skin.objectIds(): custom_skin.manage_delObjects([method_id]) @@ -534,10 +521,9 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): new_orga = folder[new_id] self.assertEquals(new_orga.getTitle(), 'something') - def test_08_AccessorGeneration(self, quiet=quiet, run=run_all_test): + def test_08_AccessorGeneration(self): """Tests accessor generation doesn't generate error messages. """ - if not run: return from Products.ERP5Type.Base import _aq_reset _aq_reset() self._catch_log_errors(ignored_level=INFO) @@ -549,13 +535,12 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): finally: self._ignore_log_errors() - def test_09_RenameObjects(self, quiet=quiet, run=run_all_test): + def test_09_RenameObjects(self): """Test object renaming. As we overloaded some parts of OFS, it's better to test again some basic features. """ - if not run: return folder = self.getOrganisationModule() id_list = [chr(x) for x in range(ord('a'), ord('z')+1)] for id_ in id_list: @@ -576,13 +561,12 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): new_id = '%s_new' % id_ self.assertEquals(folder._getOb(new_id).getId(), new_id) - def test_10_ConstraintNotFound(self, quiet=quiet, run=run_all_test): + def test_10_ConstraintNotFound(self): """ When a Constraint is not found while importing a PropertySheet, AttributeError was raised, and generated a infinite loop. This is a test to make sure this will not happens any more """ - if not run: return text = """ class TestPropertySheet: \"\"\" @@ -611,7 +595,7 @@ class TestPropertySheet: organisation = self.assertRaises(ConstraintNotFound, folder.newContent, portal_type='Organisation') - def test_11_valueAccessor(self, quiet=quiet, run=run_all_test): + def test_11_valueAccessor(self): """ The purpose of this test is to make sure that category accessors work as expected. @@ -625,15 +609,8 @@ class TestPropertySheet: The test is implemented for both Category and Value accessors. """ - if not run: return - - if not quiet: - message = 'Test Category setters' - ZopeTestCase._print('\n '+message) - LOG('Testing... ', 0, message) - # Create a few categories - region_category = self.getPortal().portal_categories.region + region_category = self.portal.portal_categories.region alpha = region_category.newContent( portal_type = "Category", id = "alpha", @@ -774,20 +751,13 @@ class TestPropertySheet: person.setRegionUid([person.getUid(), alpha.getUid(), beta.getUid()]) self.assertEquals(person.getRegionList(), [person.getRelativeUrl(), 'alpha', 'beta']) - def test_12_listAccessor(self, quiet=quiet, run=run_all_test): + def test_12_listAccessor(self): """ The purpose of this test is to make sure that accessor for sequence types support the same kind of semantics as the one on categories. We use 'subject' of the DublinCore propertysheet on organisation documents for this test. """ - if not run: return - - if not quiet: - message = 'Test Category setters' - ZopeTestCase._print('\n '+message) - LOG('Testing... ', 0, message) - # Create a new person module = self.getPersonModule() person = module.newContent(portal_type='Person') @@ -821,7 +791,7 @@ class TestPropertySheet: self.assertEquals(result, ['alpha', 'beta']) self.assertEquals(person.getSubjectList(), ['alpha', 'beta']) - def test_13_acquiredAccessor(self, quiet=quiet, run=run_all_test): + def test_13_acquiredAccessor(self): """ The purpose of this test is to make sure that accessor for sequence types support the same kind of semantics as the @@ -843,7 +813,6 @@ class TestPropertySheet: """ Tests that the default value is returned correctly """ - portal = self.getPortal() module = self.getPersonModule() person = module.newContent(id='1', portal_type='Person') @@ -875,12 +844,10 @@ class TestPropertySheet: self.assertEquals(person.getProperty(property_name, 'foo'), 'foo') self.assertEquals(person.getProperty(property_name, d='foo'), 'foo') - def test_15b_DefaultValueDefinedOnPropertySheet(self, quiet=quiet, - run=run_all_test): + def test_15b_DefaultValueDefinedOnPropertySheet(self): """Tests that the default value is returned correctly when a default value is defined using the property sheet. """ - if not run: return self._addProperty('Person', '''{'id': 'dummy_ps_prop', 'type': 'string', 'mode': 'w', @@ -953,10 +920,9 @@ class TestPropertySheet: self.assertEquals('foo', person.getDescription('foo')) - def test_16_SimpleStringAccessor(self,quiet=quiet, run=run_all_test): + def test_16_SimpleStringAccessor(self): """Tests a simple string accessor. This is also a way to test _addProperty method """ - if not run: return self._addProperty('Person', '''{'id': 'dummy_ps_prop', 'type': 'string', 'mode': 'w',}''') @@ -1054,11 +1020,10 @@ class TestPropertySheet: 'acquired_property_id': ('title', 'reference'), 'mode': 'w', }''' - def test_18_SimpleContentAccessor(self,quiet=quiet, run=run_all_test): + def test_18_SimpleContentAccessor(self): """Tests a simple content accessor. This tests content accessors, for properties that have class methods. """ - if not run: return # For testing purposes, we add a default_organisation inside a person, # and we add code to generate a 'default_organisation_title' property on # this person that will returns the organisation title. @@ -1213,10 +1178,9 @@ class TestPropertySheet: 'acquisition_depends' : None, 'mode': 'w', }''' - def test_19_AcquiredContentAccessor(self,quiet=quiet, run=run_all_test): + def test_19_AcquiredContentAccessor(self): """Tests an acquired content accessor. """ - if not run: return # For testing purposes, we add a default_organisation inside a person, # and we add code to generate a 'default_organisation_title' property on # this person that will returns the organisation title. If this is not @@ -1249,12 +1213,11 @@ class TestPropertySheet: self.assertEquals(other_pers_title, other_pers.getDefaultOrganisationTitle()) - def test_19b_AcquiredContentAccessorWithIdClash(self,quiet=quiet, run=run_all_test): + def test_19b_AcquiredContentAccessorWithIdClash(self): """Tests a content setters do not set the property on acquired object that may have the same id, using same scenario as test_19 Note that we only test Setter for now. """ - if not run: return self._addProperty('Person', self.DEFAULT_ORGANISATION_TITLE_ACQUIRED_PROP) # add destination base category to Person TI person_ti = self.getTypesTool().getTypeInfo('Person') @@ -1293,12 +1256,11 @@ class TestPropertySheet: 'acquisition_depends' : None, 'mode': 'rw', }''' - def test_19c_AcquiredTokensAccessor(self,quiet=quiet, run=run_all_test): + def test_19c_AcquiredTokensAccessor(self): """Tests an acquired tokens accessor. We check in particular that getDefault[Property] and setDefault[Property] are working correctly """ - if not run: return self._addProperty('Person', self.DEFAULT_LANGUAGE_PROP) self._addProperty('Email', self.DEFAULT_LANGUAGE_PROP) @@ -1318,11 +1280,10 @@ class TestPropertySheet: - def test_20_AsContext(self,quiet=quiet, run=run_all_test): + def test_20_AsContext(self): """asContext method return a temporary copy of an object. Any modification made to the copy does not change the original object. """ - if not run: return obj = self.getPersonModule().newContent(portal_type='Person') obj.setTitle('obj title') copy = obj.asContext() @@ -1357,10 +1318,9 @@ class TestPropertySheet: self.assertEquals(gender.getCategoryRelativeUrl(), new_copy.getGender()) self.assertEquals(None, obj.getGender()) - def test_21_ActionCondition(self, quiet=quiet, run=run_all_test): + def test_21_ActionCondition(self): """Tests action conditions """ - if not run: return type_tool = self.getTypeTool() portal_type_object = type_tool['Organisation'] def addCustomAction(name,condition): @@ -1467,15 +1427,13 @@ class TestPropertySheet: # Avoid deletion of actions fo rother tests transaction.abort() - def test_22_securityReindex(self, quiet=quiet, run=run_all_test): + def test_22_securityReindex(self): """ Tests that the security is reindexed when a role is changed on an object. Note: Turn on Person.acquire_local_roles to 0 in afterSetUp. """ - if not run: return - - portal = self.getPortal() + portal = self.portal # turn on Person.acquire_local_roles person = self.getTypesTool().getTypeInfo('Person') @@ -1527,18 +1485,16 @@ class TestPropertySheet: self.logout() self.login() - def test_23_titleIsNotDefinedByDefault(self, quiet=quiet, run=run_all_test): + def test_23_titleIsNotDefinedByDefault(self): """ Tests that no title attribute is set on new content """ - if not run: return - portal = self.getPortal() person_module = self.getPersonModule() person = person_module.newContent(portal_type='Person') self.assertFalse(person.hasTitle()) self.assertFalse(person.__dict__.has_key('title')) - def test_24_relatedValueAccessor(self, quiet=quiet, run=run_all_test): + def test_24_relatedValueAccessor(self): """ The purpose of this test is to make sure that category related accessors work as expected. @@ -1548,15 +1504,8 @@ class TestPropertySheet: Test that checked_permission is well configured for View permission """ - if not run: return - - if not quiet: - message = 'Test Related Value Accessors' - ZopeTestCase._print('\n '+message) - LOG('Testing... ', 0, message) - # Create a few categories - region_category = self.getPortal().portal_categories.region + region_category = self.portal.portal_categories.region alpha = region_category.newContent( portal_type = "Category", id = "alpha", @@ -1636,7 +1585,7 @@ class TestPropertySheet: checked_permission="View"), [doo.getTitle(), bar.getTitle(), ]) - def test_25_AqDynamicWithTempObject(self, quiet=quiet, run=run_all_test): + def test_25_AqDynamicWithTempObject(self): """Check if _aq_dynamic works correctly, regardless of whether it is first called for a temporary object or a persistent object. @@ -1646,9 +1595,7 @@ class TestPropertySheet: such methods from a persistent object may fail, because such a persistent object is not an instance of the temporary document class. """ - if not run: return - portal = self.getPortal() - + portal = self.portal # Clear out all generated methods. _aq_reset() @@ -1716,7 +1663,7 @@ class TestPropertySheet: obj.setFooBar('something') self.assertTrue(obj.hasFooBar()) - def test_27_categoryAccessors(self, quiet=quiet, run=run_all_test): + def test_27_categoryAccessors(self): """ The purpose of this test is to make sure that category accessors work as expected. @@ -1727,13 +1674,6 @@ class TestPropertySheet: Test that checked_permission is well configured for View permission """ - if not run: return - - if not quiet: - message = 'Test Category Accessors' - ZopeTestCase._print('\n '+message) - LOG('Testing... ', 0, message) - # Create a few categories region_category = self.getPortal().portal_categories.region beta_id = "beta" @@ -2335,11 +2275,10 @@ class TestPropertySheet: self.assertRaises(ValueError, getattr, not_ok, 'attr') self.assertFalse(hasattr(not_ok, 'attr')) - def test_renameObjectsReindexSubobjects(self, quiet=quiet, run=run_all_test): + def test_renameObjectsReindexSubobjects(self): """Test that renaming an object with subobjects causes them to be reindexed (their path must be updated). """ - if not run: return folder = self.getOrganisationModule() sql_catalog = self.portal.portal_catalog.getSQLCatalog() initial_id = 'foo' @@ -2358,24 +2297,22 @@ class TestPropertySheet: subdocument_record = sql_catalog.getRecordForUid(subdocument.uid) self.assertEqual(subdocument.getPath(), subdocument_record.path) - def test_getCreationDate(self, quiet=quiet, run=run_all_test): + def test_getCreationDate(self): """ Check that getCreationDate does not acquire creation_date property from site. """ - if not run: return portal = self.getPortalObject() folder = self.getOrganisationModule() object = folder.newContent(portal_type='Organisation') self.assertNotEquals(object.getCreationDate(), portal.CreationDate()) self.assertNotEquals(object.getCreationDate(), folder.getCreationDate()) - def test_copyWithoutModificationRight(self, quiet=quiet, run=run_all_test): + def test_copyWithoutModificationRight(self): """ Check that it is possible to copy an object on which user doesn't have "Modify portal content" permission. """ - if not run: return portal = self.getPortalObject() folder = self.getOrganisationModule() object = folder.newContent(portal_type='Organisation') @@ -2599,7 +2536,7 @@ class TestPropertySheet: self.assertRaises(TypeError, person.setPropertyList, 'foo_bar', ['a', 'b']) - def testPropertyListOnMonoValuedAcquiredProperty(self,quiet=quiet, run=run_all_test): + def testPropertyListOnMonoValuedAcquiredProperty(self): """ Check that we can use setPropertyList and getPropertyList on a mono valued acquired property diff --git a/product/ERP5Type/tests/testFolder.py b/product/ERP5Type/tests/testFolder.py index a8dd660075d04a219423ccb7b9e6de81f858c7d9..6f5895836fccbcecf7ac16017a582b7ba9c3eb55 100644 --- a/product/ERP5Type/tests/testFolder.py +++ b/product/ERP5Type/tests/testFolder.py @@ -55,16 +55,16 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): Executed before each test_*. """ self.login() - self.folder = self.getPortal().newContent(id='TestFolder', + self.folder = self.portal.newContent(id='TestFolder', portal_type='Folder') - self.other_folder = self.getPortal().newContent( + self.other_folder = self.portal.newContent( id='OtherTestFolder', portal_type='Folder') def beforeTearDown(self): """ Executed after each test_*. """ - self.getPortal().manage_delObjects(ids=[self.folder.getId(), + self.portal.manage_delObjects(ids=[self.folder.getId(), self.other_folder.getId()]) clearCache() @@ -74,27 +74,19 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): """ 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 CMF's. """ - if not run : return - if not quiet: - message = 'Test folderType value' - LOG('Testing... ', 0, message) self.assertTrue(isinstance(self.getTypesTool()['Folder'], ERP5TypeInformation)) - def test_02_defaultGenerateNewId(self, quiet=0, run=1): + def test_02_defaultGenerateNewId(self): """ Test the default Id generation method. 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 self.assertEquals(self.folder.getIdGenerator(), '') self.assertEquals(len(self.folder), 0) @@ -103,14 +95,10 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor): obj = self.newContent() 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. """ - if not run : return - if not quiet: - message = 'Test custom generateNewId' - LOG('Testing... ', 0, message) id_generator_script_name = 'testIdGenerator' id_generator_id_list = ['first_id', 'second_id'] createZODBPythonScript(self.getPortal().portal_skins.erp5_core, diff --git a/product/ERP5Type/tests/testFolderMigration.py b/product/ERP5Type/tests/testFolderMigration.py index 21ae042f48f1f857d5efe1fa4b58a6aa1302f000..4d62cbb37b8489c8a05e1cd9cc4a10dc57ef578b 100644 --- a/product/ERP5Type/tests/testFolderMigration.py +++ b/product/ERP5Type/tests/testFolderMigration.py @@ -32,7 +32,6 @@ import unittest import transaction from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase -from zLOG import LOG from Products.ERP5Type.tests.utils import LogInterceptor from Products.ERP5Type.Cache import clearCache @@ -73,26 +72,18 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): """ return self.folder.newContent(portal_type='Folder', *args, **kwargs) - def test_01_folderIsBtree(self, quiet=0, run=1): + def test_01_folderIsBtree(self): """ Test the folder is a BTree """ - if not run : return - if not quiet: - message = 'Test folderIsBtree' - LOG('Testing... ', 0, message) self.assertRaises(NotImplementedError, self.folder.getTreeIdList) self.assertEqual(self.folder.isBTree(), True) self.assertEqual(self.folder.isHBTree(), False) - def test_02_migrateFolder(self, quiet=0, run=1): + def test_02_migrateFolder(self): """ migrate folder from btree to hbtree """ - if not run : return - if not quiet: - message = 'Test migrateFolder' - LOG('Testing... ', 0, message) # Create some objects self.assertEquals(self.folder.getIdGenerator(), '') self.assertEquals(len(self.folder), 0) @@ -116,9 +107,7 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): self.assertEqual(len(self.folder.objectIds()), 3) # check params of objectIds in case of hbtree self.assertEqual(len(self.folder.objectIds(base_id=None)), 0) - LOG("test", 300, "rien") self.assertEqual(len(self.folder.objectValues()), 3) - LOG("test", 300, "base_id") self.assertEqual(len(self.folder.objectValues(base_id=None)), 0) # check object ids from DateTime import DateTime @@ -131,39 +120,27 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): obj4 = self.newContent() self.assertEquals(obj4.getId().split('-')[0], date) - def test_03_emptyFolderIsBtree(self, quiet=0, run=1): + def test_03_emptyFolderIsBtree(self): """ Test the folder is a BTree """ - if not run : return - if not quiet: - message = 'Test EmptyFolderIsBtree' - LOG('Testing... ', 0, message) self.assertRaises(NotImplementedError, self.folder.getTreeIdList) self.assertEqual(self.folder.isBTree(), True) self.assertEqual(self.folder.isHBTree(), False) - def test_03a_filledFolderIsBtree(self, quiet=0, run=1): + def test_03a_filledFolderIsBtree(self): """ Test the folder is a BTree """ - if not run : return - if not quiet: - message = 'Test FilledFolderIsBtree' - LOG('Testing... ', 0, message) self.folder.newContent() self.assertRaises(NotImplementedError, self.folder.getTreeIdList) self.assertEqual(self.folder.isBTree(), True) self.assertEqual(self.folder.isHBTree(), False) - def test_04_migrateEmptyFolder(self, quiet=0, run=1): + def test_04_migrateEmptyFolder(self): """ migrate empty folder from btree to hbtree """ - if not run : return - if not quiet: - message = 'Test migrateEmptyFolder' - LOG('Testing... ', 0, message) # Create some objects self.assertEquals(self.folder.getIdGenerator(), '') self.assertEquals(len(self.folder), 0) @@ -188,11 +165,10 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): self.assertEqual(self.folder.isHBTree(), True) self.assertEqual(len(self.folder.objectIds()), 1) - def test_05_migrateFolderWithoutIdChange(self, quiet=0, run=1): + def test_05_migrateFolderWithoutIdChange(self): """ migrate folder from btree to hbtree, do not touch ids """ - if not run : return # Create some objects self.assertEquals(self.folder.getIdGenerator(), '') self.assertEquals(len(self.folder), 0) @@ -225,11 +201,10 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): obj4 = self.newContent() self.assertEquals(obj4.getId(), '4') - def test_06_migrateFolderChangeIdGenerationMethodLater(self, quiet=0, run=1): + def test_06_migrateFolderChangeIdGenerationMethodLater(self): """ migrate folder from btree to hbtree, do not touch ids """ - if not run : return # Create some objects self.assertEquals(self.folder.getIdGenerator(), '') self.assertEquals(len(self.folder), 0) @@ -279,14 +254,10 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): obj5 = self.newContent() self.assertEquals(obj5.getId().split('-')[0], date) - def test_07_migrateFolderTwice(self, quiet=0, run=1): + def test_07_migrateFolderTwice(self): """ migrate folder twice from btree to hbtree """ - if not run : return - if not quiet: - message = 'Test migrateFolder' - LOG('Testing... ', 0, message) # Create some objects self.assertEquals(self.folder.getIdGenerator(), '') self.assertEquals(len(self.folder), 0) @@ -310,9 +281,7 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): self.assertEqual(len(self.folder.objectIds()), 3) # check params of objectIds in case of hbtree self.assertEqual(len(self.folder.objectIds(base_id=None)), 0) - LOG("test", 300, "rien") self.assertEqual(len(self.folder.objectValues()), 3) - LOG("test", 300, "base_id") self.assertEqual(len(self.folder.objectValues(base_id=None)), 0) # check object ids from DateTime import DateTime @@ -336,14 +305,10 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): self.assertEquals(obj3.getId(), '%s-3' %date) self.assertEquals(obj4.getId().split('-')[0], date) - def test_08_migrateFolderTwiceSimultaneously(self, quiet=0, run=1): + def test_08_migrateFolderTwiceSimultaneously(self): """ migrate folder twice from btree to hbtree, simultaneously """ - if not run : return - if not quiet: - message = 'Test migrateFolder' - LOG('Testing... ', 0, message) # Create some objects self.assertEquals(self.folder.getIdGenerator(), '') self.assertEquals(len(self.folder), 0) @@ -370,9 +335,7 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): self.assertEqual(len(self.folder.objectIds()), 3) # check params of objectIds in case of hbtree self.assertEqual(len(self.folder.objectIds(base_id=None)), 0) - LOG("test", 300, "rien") self.assertEqual(len(self.folder.objectValues()), 3) - LOG("test", 300, "base_id") self.assertEqual(len(self.folder.objectValues(base_id=None)), 0) # check object ids from DateTime import DateTime @@ -385,12 +348,11 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): obj4 = self.newContent() self.assertEquals(obj4.getId().split('-')[0], date) - def test_09_migrateFolderCreateNewObjectAtOnce(self, quiet=0, run=1): + def test_09_migrateFolderCreateNewObjectAtOnce(self): """ migrate folder from btree to hbtree, create object with base, without any previous checks """ - if not run : return # Create some objects self.assertEquals(self.folder.getIdGenerator(), '') self.assertEquals(len(self.folder), 0) @@ -414,12 +376,11 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): self.assertEqual(len(self.folder.objectIds(base_id='BASE')), 1) self.assertEqual(len(self.folder.objectValues(base_id='BASE')), 1) - def test_10_migrateFolderCreateMoreObjectAtOnceDifferentBase(self, quiet=0, run=1): + def test_10_migrateFolderCreateMoreObjectAtOnceDifferentBase(self): """ migrate folder from btree to hbtree, create objects with two bases, without any previous checks """ - if not run : return # Create some objects self.assertEquals(self.folder.getIdGenerator(), '') self.assertEquals(len(self.folder), 0) @@ -447,14 +408,10 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): self.assertEqual(len(self.folder.objectIds(base_id='BASE-BELONG')), 1) self.assertEqual(len(self.folder.objectValues(base_id='BASE-BELONG')), 1) - def test_11_folderInMigratedFolderIsBTree(self, quiet=0, run=1): + def test_11_folderInMigratedFolderIsBTree(self): """ Test the folder in HBTree folder is a BTree """ - if not run : return - if not quiet: - message = 'Test folderIsBtree' - LOG('Testing... ', 0, message) self.folder.migrateToHBTree() transaction.commit() self.tic() @@ -464,16 +421,11 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): self.assertEqual(infolder.isBTree(), True) self.assertEqual(infolder.isHBTree(), False) - def test_12_migrateFolderWithGoodIdsInIt(self, quiet=0, run=1): + def test_12_migrateFolderWithGoodIdsInIt(self): """ migrate folder from btree to hbtree folder, which already has ids HBTree-friendly """ - if not run : return - if not quiet: - message = 'Test migrateFolder' - LOG('Testing... ', 0, message) - id_prefix = 'BASE' obj1_id = '%s-1'%(id_prefix,) obj2_id = '%s-2'%(id_prefix,) @@ -506,12 +458,7 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): self.assertEqual(len(self.folder.objectValues()), 4) self.assertEqual(len(self.folder.objectValues(base_id=id_prefix)), 3) - def test_13_wrongFolderHandlerFix(self, quiet=0, run=1): - if not run : return - if not quiet: - message = 'Test migrateFolder' - LOG('Testing... ', 0, message) - + def test_13_wrongFolderHandlerFix(self): self.assertEqual(self.folder.isBTree(), True) self.assertEqual(self.folder.isHBTree(), False) @@ -535,12 +482,7 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): self.assertEqual(self.folder.isBTree(), False) self.assertEqual(self.folder.isHBTree(), True) - def test_14_wrongFolderHandlerMigrate(self, quiet=0, run=1): - if not run : return - if not quiet: - message = 'Test migrateFolder' - LOG('Testing... ', 0, message) - + def test_14_wrongFolderHandlerMigrate(self): self.assertEqual(self.folder.isBTree(), True) self.assertEqual(self.folder.isHBTree(), False) diff --git a/product/ERP5Type/tests/testSessionTool.py b/product/ERP5Type/tests/testSessionTool.py index d67469ee12ca6e0bce3e4892eb7f06016a442777..751211b4778730ed9f05d34025693e66afb3da4b 100644 --- a/product/ERP5Type/tests/testSessionTool.py +++ b/product/ERP5Type/tests/testSessionTool.py @@ -28,10 +28,8 @@ import unittest -from Testing import ZopeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from AccessControl.SecurityManagement import newSecurityManager -from zLOG import LOG from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.Tool.SessionTool import SESSION_CACHE_FACTORY from string import letters as LETTERS @@ -52,7 +50,6 @@ primitives_kw = dict(attr_1 = ['list_item'], \ class TestSessionTool(ERP5TypeTestCase): - run_all_test = 1 session_id = "123456789" def getTitle(self): @@ -75,7 +72,7 @@ class TestSessionTool(ERP5TypeTestCase): url_string='127.0.0.1:11211') self.login() - def login(self, quiet=0, run=run_all_test): + def login(self): uf = self.getPortal().acl_users uf._doAddUser('ivan', '', ['Manager'], []) uf._doAddUser('ERP5TypeTestCase', '', ['Manager'], []) @@ -267,26 +264,12 @@ class TestSessionTool(ERP5TypeTestCase): session = self.portal.portal_sessions[self.session_id] self.assertEquals(session.get('key'), 'value') - def test_01_CheckSessionTool(self, quiet=0, run=run_all_test): - """ Create portal_sessions tool and needed cache factory. """ - if not run: - 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_01_CheckSessionTool(self): + """ Checks session tool is present """ + self.assertNotEqual(None, getattr(self.portal, 'portal_sessions', None)) + def test_02_RamSession(self): + """ Test RamSession which uses local RAM based cache plugin. """ sequence_list = SequenceList() sequence_string = 'stepTestSetGet \ stepTestAcquisitionRamSessionStorage \ @@ -301,15 +284,8 @@ class TestSessionTool(ERP5TypeTestCase): sequence_list.addSequenceString(sequence_string) 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. """ - if not run: - return - if not quiet: - message = '\nTest Distributed Session (memcached).' - ZopeTestCase._print(message) - LOG('Testing... ', 0, message) - # create memcached plugin and test self._changeCachePlugin('Distributed Ram Cache') sequence_list = SequenceList() diff --git a/product/ERP5Type/tests/testTimerService.py b/product/ERP5Type/tests/testTimerService.py index 3174f7f11d8b1511818e170e67f36a44805ec11d..fd1e3390f7d525ffb48b49ef637240b2b12a426d 100644 --- a/product/ERP5Type/tests/testTimerService.py +++ b/product/ERP5Type/tests/testTimerService.py @@ -41,8 +41,6 @@ class TestTimerService(ERP5TypeTestCase): idea to put an ERP5-type test in it. """ - run_all_test = 1 - def getTitle(self): return "TimerService" @@ -51,34 +49,16 @@ class TestTimerService(ERP5TypeTestCase): """ return () - def login(self, quiet=0, run=run_all_test): - uf = self.getPortal().acl_users + def afterSetUp(self): + uf = self.portal.acl_users uf._doAddUser('rc', '', ['Manager'], []) user = uf.getUserById('rc').__of__(uf) newSecurityManager(None, user) - def enableLightInstall(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): + def test_01_checkAnonymousProcessing(self): """ Test whether a timer can be invoked by anonymous. """ - if not run: return noSecurityManager() timer_service = self.app.Control_Panel.timer_service process_timer = guarded_getattr(timer_service, 'process_timer') diff --git a/product/ERP5Type/tests/testTransactionalVariable.py b/product/ERP5Type/tests/testTransactionalVariable.py index f6c76f033b0cb08a798782db248d6c316117c4eb..bb1b7fc6465a5360096f1f4df0e19f890fe7a992 100644 --- a/product/ERP5Type/tests/testTransactionalVariable.py +++ b/product/ERP5Type/tests/testTransactionalVariable.py @@ -28,9 +28,7 @@ import unittest -from Testing import ZopeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase -from zLOG import LOG from Products.ERP5Type.tests.utils import LogInterceptor from Products.ERP5Type.TransactionalVariable import getTransactionalVariable @@ -40,9 +38,6 @@ except ImportError: pass class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor): - run_all_test = 1 - quiet = 1 - # Some helper methods def getTitle(self): @@ -57,16 +52,10 @@ class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor): def afterSetUp(self): self.login() - def test_01_DictInterface(self, quiet=quiet, run=run_all_test): - """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()) + def test_01_DictInterface(self): + """Check if a transaction variable behaves in the same way as a dict. """ + + tv = getTransactionalVariable(self.portal) self.failIfEqual(tv, None) # Test frequently used dict methods. This does not cover everything, @@ -89,17 +78,11 @@ class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor): self.failIf('foo' in tv) 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 transactions. """ - if not run: return - if not quiet: - message = 'Test Expiration' - ZopeTestCase._print('\n '+message) - LOG('Testing... ', 0, message) - - tv = getTransactionalVariable(self.getPortal()) + tv = getTransactionalVariable(self.portal) self.failIfEqual(tv, None) tv.clear() @@ -117,17 +100,11 @@ class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor): get_transaction().abort() 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 transaction. """ - if not run: return - if not quiet: - message = 'Test Durability' - ZopeTestCase._print('\n '+message) - LOG('Testing... ', 0, message) - - tv = getTransactionalVariable(self.getPortal()) + tv = getTransactionalVariable(self.portal) self.failIfEqual(tv, None) tv.clear()