[Erp5-report] r35159 jerome - /erp5/trunk/products/ERP5Type/tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue May 11 10:06:31 CEST 2010
Author: jerome
Date: Tue May 11 10:06:28 2010
New Revision: 35159
URL: http://svn.erp5.org?rev=35159&view=rev
Log:
remove quiet and run_all tests from signatures
replace self.getPoral() by self.portal
Modified:
erp5/trunk/products/ERP5Type/tests/CodingStyleTestCase.py
erp5/trunk/products/ERP5Type/tests/testClassTool.py
erp5/trunk/products/ERP5Type/tests/testConstraint.py
erp5/trunk/products/ERP5Type/tests/testERP5Type.py
erp5/trunk/products/ERP5Type/tests/testFolder.py
erp5/trunk/products/ERP5Type/tests/testFolderMigration.py
erp5/trunk/products/ERP5Type/tests/testSessionTool.py
erp5/trunk/products/ERP5Type/tests/testTimerService.py
erp5/trunk/products/ERP5Type/tests/testTransactionalVariable.py
Modified: erp5/trunk/products/ERP5Type/tests/CodingStyleTestCase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/CodingStyleTestCase.py?rev=35159&r1=35158&r2=35159&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/CodingStyleTestCase.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/CodingStyleTestCase.py [utf8] Tue May 11 10:06:28 2010
@@ -34,8 +34,6 @@
class CodingStyleTestCase(ERP5TypeTestCase):
"""XXX
"""
- run_all_test = 1
- quiet = 0
manager_username = 'zope'
manager_password = 'zope'
website_id = 'test'
@@ -63,24 +61,18 @@
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 @@
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():
Modified: erp5/trunk/products/ERP5Type/tests/testClassTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testClassTool.py?rev=35159&r1=35158&r2=35159&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testClassTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testClassTool.py [utf8] Tue May 11 10:06:28 2010
@@ -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 @@
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(), [],
Modified: erp5/trunk/products/ERP5Type/tests/testConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testConstraint.py?rev=35159&r1=35158&r2=35159&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testConstraint.py [utf8] Tue May 11 10:06:28 2010
@@ -29,17 +29,13 @@
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"
@@ -305,11 +301,10 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
object = object,
)
- def test_StringAttributeMatchConstraint(self, quiet=quiet, run=run_all_test):
- """
- Tests Content Existence
- """
- if not run: return
+ def test_StringAttributeMatchConstraint(self):
+ """
+ Tests string attribute match
+ """
sequence_list = SequenceList()
# Test Constraint with empty Title
sequence_string = '\
@@ -1396,7 +1382,7 @@
'
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 @@
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 @@
'
sequence_list.addSequenceString(sequence_string)
- sequence_list.play(self, quiet=quiet)
+ sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
Modified: erp5/trunk/products/ERP5Type/tests/testERP5Type.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testERP5Type.py?rev=35159&r1=35158&r2=35159&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testERP5Type.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testERP5Type.py [utf8] Tue May 11 10:06:28 2010
@@ -34,10 +34,9 @@
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 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 @@
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 @@
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 @@
# 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
"""
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 @@
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 @@
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 @@
'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 @@
'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 @@
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 @@
'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 @@
- 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 @@
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 @@
# 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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
Modified: erp5/trunk/products/ERP5Type/tests/testFolder.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testFolder.py?rev=35159&r1=35158&r2=35159&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testFolder.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testFolder.py [utf8] Tue May 11 10:06:28 2010
@@ -55,16 +55,16 @@
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 @@
"""
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 @@
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,
Modified: erp5/trunk/products/ERP5Type/tests/testFolderMigration.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testFolderMigration.py?rev=35159&r1=35158&r2=35159&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testFolderMigration.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testFolderMigration.py [utf8] Tue May 11 10:06:28 2010
@@ -32,7 +32,6 @@
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 @@
"""
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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)
Modified: erp5/trunk/products/ERP5Type/tests/testSessionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testSessionTool.py?rev=35159&r1=35158&r2=35159&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testSessionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testSessionTool.py [utf8] Tue May 11 10:06:28 2010
@@ -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 @@
class TestSessionTool(ERP5TypeTestCase):
- run_all_test = 1
session_id = "123456789"
def getTitle(self):
@@ -75,7 +72,7 @@
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 @@
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):
+ 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. """
- if not run:
- return
- if not quiet:
- message = '\nTest Ram Session.'
- ZopeTestCase._print(message)
- LOG('Testing... ', 0, message)
-
sequence_list = SequenceList()
sequence_string = 'stepTestSetGet \
stepTestAcquisitionRamSessionStorage \
@@ -301,15 +284,8 @@
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()
Modified: erp5/trunk/products/ERP5Type/tests/testTimerService.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testTimerService.py?rev=35159&r1=35158&r2=35159&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testTimerService.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testTimerService.py [utf8] Tue May 11 10:06:28 2010
@@ -41,8 +41,6 @@
idea to put an ERP5-type test in it.
"""
- run_all_test = 1
-
def getTitle(self):
return "TimerService"
@@ -51,34 +49,16 @@
"""
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')
Modified: erp5/trunk/products/ERP5Type/tests/testTransactionalVariable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testTransactionalVariable.py?rev=35159&r1=35158&r2=35159&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testTransactionalVariable.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testTransactionalVariable.py [utf8] Tue May 11 10:06:28 2010
@@ -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 @@
pass
class TestTransactionalVariable(ERP5TypeTestCase, LogInterceptor):
- run_all_test = 1
- quiet = 1
-
# Some helper methods
def getTitle(self):
@@ -57,16 +52,10 @@
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 @@
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 @@
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()
More information about the Erp5-report
mailing list