Commit 8d8066c9 authored by Jérome Perrin's avatar Jérome Perrin

core_test: address pylint messages and other small cleanups

parent a148fcc9
......@@ -100,11 +100,13 @@
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -117,7 +119,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -79,7 +79,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
"""
return ('erp5_base',)
def login(self):
def login(self): # pylint:disable=arguments-differ
uf = self.getPortal().acl_users
uf._doAddUser(self.username, '', ['Manager'], [])
user = uf.getUserById(self.username).__of__(uf)
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testBase</string> </value>
......@@ -43,11 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 82, 2: Arguments number differs from overridden \'login\' method (arguments-differ)</string>
<string>W:951, 10: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:1034, 10: Redefining built-in \'id\' (redefined-builtin)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -57,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -76,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -85,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -49,51 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 68, 2: Arguments number differs from overridden \'_catch_log_errors\' method (arguments-differ)</string>
<string>W: 85, 2: Arguments number differs from overridden \'_ignore_log_errors\' method (arguments-differ)</string>
<string>W:135, 10: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:427, 8: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:618, 6: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:606, 4: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:617, 8: Unused variable \'i\' (unused-variable)</string>
<string>W:642, 6: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:641, 8: Unused variable \'i\' (unused-variable)</string>
<string>W:696, 6: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:709, 6: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:1191, 8: Unused variable \'i\' (unused-variable)</string>
<string>W:1259, 8: Unused variable \'i\' (unused-variable)</string>
<string>W:1337, 10: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:1353, 10: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:1366, 10: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:1377, 10: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:1389, 10: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:1389, 14: Unused variable \'wf_ids\' (unused-variable)</string>
<string>W:1445, 10: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:1477, 4: Redefining built-in \'bin\' (redefined-builtin)</string>
<string>W:1713, 4: Redefining built-in \'filter\' (redefined-builtin)</string>
<string>W:1730, 4: Redefining built-in \'filter\' (redefined-builtin)</string>
<string>W:1750, 6: Expression "catalog._getFilterDict()[method_id]" is assigned to nothing (expression-not-assigned)</string>
<string>W:1771, 6: Expression "catalog._getFilterDict()[method_id]" is assigned to nothing (expression-not-assigned)</string>
<string>W:2468, 4: Unreachable code (unreachable)</string>
<string>W:2743, 12: Unused variable \'key\' (unused-variable)</string>
<string>W:2863, 4: No exception type(s) specified (bare-except)</string>
<string>W:2874, 4: No exception type(s) specified (bare-except)</string>
<string>W:2968, 10: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:2998, 10: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:2998, 14: Unused variable \'wf_ids\' (unused-variable)</string>
<string>W:3013, 10: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:3013, 14: Unused variable \'wf_ids\' (unused-variable)</string>
<string>W:3028, 10: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:3066, 6: Unused variable \'portal_type\' (unused-variable)</string>
<string>W:3143, 69: Unused variable \'i\' (unused-variable)</string>
<string>W:6460, 8: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:6855, 4: Unused variable \'new_object\' (unused-variable)</string>
<string>W:7169, 4: Unused variable \'bt\' (unused-variable)</string>
<string>W:7174, 4: Unused variable \'bt\' (unused-variable)</string>
<string>W:7360, 4: Unused variable \'broken\' (unused-variable)</string>
<string>W: 45, 0: Unused import gc (unused-import)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......
......@@ -65,8 +65,7 @@ class TestRamCache(ERP5TypeTestCase):
test_scopes.sort()
## remove DistributedRamCache since it's a flat storage
filtered_cache_plugins = filter(
lambda x: not isinstance(x, DistributedRamCache), self.cache_plugins)
filtered_cache_plugins = [x for x in self.cache_plugins if not isinstance(x, DistributedRamCache)]
for cache_plugin in filtered_cache_plugins:
if not self.quiet:
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testCache</string> </value>
......@@ -43,9 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 68, 29: map/filter on lambda could be replaced by comprehension (deprecated-lambda)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -55,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -74,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -83,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -65,7 +65,7 @@ class TestCacheTool(ERP5TypeTestCase):
self.createCachedMethod()
self.commit()
def login(self):
def login(self): # pylint:disable=arguments-differ
uf = self.portal.acl_users
uf._doAddUser('admin', '', ['Manager'], [])
uf._doAddUser('ERP5TypeTestCase', '', ['Manager'], [])
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testCacheTool</string> </value>
......@@ -43,9 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 68, 2: Arguments number differs from overridden \'login\' method (arguments-differ)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -55,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -74,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -83,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -57,7 +57,7 @@ class TestCachedSkinsTool(ERP5TypeTestCase):
# Use None as skinname to keep using the default one.
self.getSkinnableObject().changeSkin(skinname=None)
def login(self):
def login(self): # pylint:disable=arguments-differ
uf = self.portal.acl_users
uf._doAddUser('vincent', '', ['Manager'], [])
user = uf.getUserById('vincent').__of__(uf)
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testCachedSkinsTool</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5Type.tests.testCachedSkinsTool</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testCachedSkinsTool</string> </value>
......@@ -37,9 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 60, 2: Arguments number differs from overridden \'login\' method (arguments-differ)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -49,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -68,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -77,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -49,7 +49,7 @@ class TestConstraint(PropertySheetTestCase):
"""
return ('erp5_base',)
def login(self):
def login(self): # pylint:disable=arguments-differ
uf = self.portal.acl_users
uf._doAddUser('rc', '', ['Manager'], [])
user = uf.getUserById('rc').__of__(uf)
......@@ -114,26 +114,24 @@ class TestConstraint(PropertySheetTestCase):
Create a object which will be tested.
"""
module = self.portal.getDefaultModule(self.object_portal_type)
object = module.newContent(portal_type=self.object_portal_type)
group1 = object.portal_categories.restrictedTraverse('group/testGroup1')
document = module.newContent(portal_type=self.object_portal_type)
group1 = document.portal_categories.restrictedTraverse('group/testGroup1')
if sequence:
sequence.edit(
object=object,
document=document,
group=group1,
)
return object
return document
def stepSetObjectGroup(self, sequence=None,
sequence_list=None, **kw):
"""
Set a group to object
"""
object = sequence.get('object')
# group1 = object.portal_categories.restrictedTraverse('group/testGroup1')
# object.edit(group_value=group1)
object.edit(group='testGroup1')
document = sequence.get('document')
document.edit(group='testGroup1')
self.assertNotEqual(
object.getGroup(portal_type=()),
document.getGroup(portal_type=()),
None )
def stepSetObjectGroupOrganisation(self, sequence=None,
......@@ -141,11 +139,11 @@ class TestConstraint(PropertySheetTestCase):
"""
Set a group to object, forcing portal_type color to Organisation
"""
object = sequence.get('object')
object.setGroup(object.getRelativeUrl(),
document = sequence.get('document')
document.setGroup(document.getRelativeUrl(),
portal_type='Organisation')
self.assertNotEqual(
object.getGroup(portal_type='Organisation'),
document.getGroup(portal_type='Organisation'),
None )
def stepSetObjectGroupList(self, sequence=None,
......@@ -153,68 +151,65 @@ class TestConstraint(PropertySheetTestCase):
"""
Set a group to object
"""
object = sequence.get('object')
# group1 = object.portal_categories.restrictedTraverse('group/testGroup1')
# group2 = object.portal_categories.restrictedTraverse('group/testGroup2')
# object.edit(group_value_list=[group1, group2])
object.edit(group_list=['testGroup1', 'testGroup2'])
document = sequence.get('document')
document.edit(group_list=['testGroup1', 'testGroup2'])
def stepSetObjectTitle(self, sequence=None,
sequence_list=None, **kw):
"""
Set a different title value
"""
object = sequence.get('object')
document = sequence.get('document')
object_title = self.object_title
object.setTitle(object_title)
document.setTitle(object_title)
def stepSetObjectNoneTitle(self, sequence=None,
sequence_list=None, **kw):
"""
Set a different title value
"""
object = sequence.get('object')
document = sequence.get('document')
# Do not call edit, as we want to explicitely modify the property
# (and edit modify only if value is different)
object.setTitle(None)
document.setTitle(None)
def stepSetObjectEmptyTitle(self, sequence=None,
sequence_list=None, **kw):
"""
Set a different title value
"""
object = sequence.get('object')
document = sequence.get('document')
# Do not call edit, as we want to explicitely modify the property
# (and edit modify only if value is different)
object.setTitle('')
document.setTitle('')
def stepSetObjectIntTitle(self, sequence=None,
sequence_list=None, **kw):
"""
Set a different title value
"""
object = sequence.get('object')
object.edit(title=12345)
document = sequence.get('document')
document.edit(title=12345)
def stepSetObjectBadTypedProperty(self, sequence=None,
sequence_list=None, **kw):
"""
Set a property with a bad type
"""
object = sequence.get('object')
document = sequence.get('document')
property_name = 'ean13code'
# make sure the property is defined on the object
self.assertTrue(not object.hasProperty(property_name))
self.assertTrue(object.getPropertyType(property_name) != 'int')
object.setProperty(property_name, 12)
# make sure the property is defined on the document
self.assertTrue(not document.hasProperty(property_name))
self.assertTrue(document.getPropertyType(property_name) != 'int')
document.setProperty(property_name, 12)
def stepSetObjectIntLocalProperty(self, sequence=None,
sequence_list=None, **kw):
"""
Set a local property on the object, with an int type.
Set a local property on the document, with an int type.
"""
object = sequence.get('object')
object.edit(local_prop = 12345)
document = sequence.get('document')
document.edit(local_prop = 12345)
def _createGenericConstraint(self, sequence=None, klass_name='Constraint',
**kw):
......@@ -225,9 +220,7 @@ class TestConstraint(PropertySheetTestCase):
module = Constraint
file_path = "%s.%s" % (module.__name__, klass_name)
__import__(file_path)
file = getattr(module, klass_name)
klass = file
# klass = getattr(file, klass_name)
klass = getattr(module, klass_name)
constraint = klass(**kw)
if sequence is not None:
sequence.edit(constraint=constraint,)
......@@ -238,10 +231,10 @@ class TestConstraint(PropertySheetTestCase):
"""
Call checkConsistency of a Constraint.
"""
object = sequence.get('object')
document = sequence.get('document')
constraint = sequence.get('constraint')
# Check
error_list = constraint.checkConsistency(object)
error_list = constraint.checkConsistency(document)
sequence.edit(
error_list=error_list
)
......@@ -251,10 +244,10 @@ class TestConstraint(PropertySheetTestCase):
"""
Call checkConsistency of a Constraint, fixing the errors.
"""
object = sequence.get('object')
document = sequence.get('document')
constraint = sequence.get('constraint')
# Check
error_list = constraint.checkConsistency(object, fixit=1)
error_list = constraint.checkConsistency(document, fixit=1)
sequence.edit(
error_list=error_list
)
......@@ -264,10 +257,10 @@ class TestConstraint(PropertySheetTestCase):
"""
Call checkConsistency of a Constraint.
"""
object = sequence.get('group')
document = sequence.get('group')
constraint = sequence.get('constraint')
# Check
error_list = constraint.checkConsistency(object)
error_list = constraint.checkConsistency(document)
sequence.edit(
error_list=error_list
)
......@@ -1327,8 +1320,8 @@ class TestConstraint(PropertySheetTestCase):
"""
Create a Content Object inside one Object
"""
object = sequence.get('object')
content_object = object.newContent(portal_type=self.object_content_portal_type)
document = sequence.get('document')
content_object = document.newContent(portal_type=self.object_content_portal_type)
sequence.edit(
content_object = content_object,
)
......@@ -1373,20 +1366,20 @@ class TestConstraint(PropertySheetTestCase):
"""
Set valid Title to Object
"""
object = sequence.get('object')
object.setTitle(self.object_title)
document = sequence.get('document')
document.setTitle(self.object_title)
sequence.edit(
object = object,
document = document,
)
def stepSetObjectTitle1(self, sequence=None, sequence_list=None, **kw):
"""
Set empty (or invalid string) to Object
"""
object = sequence.get('object')
object.setTitle(' ')
document = sequence.get('document')
document.setTitle(' ')
sequence.edit(
object = object,
document = document,
)
def test_StringAttributeMatchConstraint(self):
......@@ -1527,13 +1520,13 @@ class TestConstraint(PropertySheetTestCase):
def stepValidateObject(self, sequence=None, sequence_list=None, **kw):
"""
"""
document = sequence.get('object')
document = sequence.get('document')
document.validate()
def stepInvalidateObject(self, sequence=None, sequence_list=None, **kw):
"""
"""
document = sequence.get('object')
document = sequence.get('document')
document.invalidate()
def stepCreateAttributeUnicityConstraint(self, sequence=None,
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testConstraint</string> </value>
......@@ -43,26 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 52, 2: Arguments number differs from overridden \'login\' method (arguments-differ)</string>
<string>W:117, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:131, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:144, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:156, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:167, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:176, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:186, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:196, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:204, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:216, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:228, 4: Redefining built-in \'file\' (redefined-builtin)</string>
<string>W:241, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:254, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:267, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:1330, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:1376, 4: Redefining built-in \'object\' (redefined-builtin)</string>
<string>W:1386, 4: Redefining built-in \'object\' (redefined-builtin)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -72,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -91,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -100,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -28,7 +28,7 @@
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
class TestERP5Category(ERP5TypeTestCase):
......@@ -64,7 +64,6 @@ class TestERP5Category(ERP5TypeTestCase):
return self.getSalePackingListModule()['1']
def afterSetUp(self):
self.login()
# This add the base category size
portal_categories = self.getCategoryTool()
person_module = self.getPersonModule()
......@@ -155,12 +154,6 @@ class TestERP5Category(ERP5TypeTestCase):
self.commitAndTic()
def login(self):
uf = self.getPortal().acl_users
uf._doAddUser('seb', '', ['Manager'], [])
user = uf.getUserById('seb').__of__(uf)
newSecurityManager(None, user)
def commitAndTic(self):
"""Just to save one line.
"""
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testERP5Category</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testERP5Category</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testERP5Category</string> </value>
......@@ -37,9 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W:158, 2: Arguments number differs from overridden \'login\' method (arguments-differ)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -49,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -68,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -77,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -65,7 +65,7 @@ if 1: # BBB
*args, **kw)
def setGlobalTranslationService(translation_service):
global global_translation_service
global global_translation_service # pylint:disable=global-statement
global_translation_service = translation_service
zope.component.provideUtility(DummyTranslationDomainFallback,
provides=IFallbackTranslationDomainFactory)
......@@ -578,9 +578,8 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
0 != i.getUid() != i.getProperty('uid')])
def test_04_site_manager_and_translation_migration(self):
from zope.site.hooks import getSite, setSite
from zope.site.hooks import setSite
from zope.component import queryUtility
from zope.i18n.interfaces import ITranslationDomain
# check translation is working normaly
erp5_ui_catalog = self.portal.Localizer.erp5_ui
self.assertEqual(queryUtility(ITranslationDomain, 'erp5_ui'),
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testERP5Core</string> </value>
......@@ -43,10 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 67, 4: Using the global statement (global-statement)</string>
<string>W:578, 4: Redefining name \'ITranslationDomain\' from outer scope (line 53) (redefined-outer-name)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -56,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -75,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -84,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -99,8 +99,6 @@ class TestERP5Workflow(ERP5TypeTestCase):
transition2.setReference('transition2')
state1.setDestinationValueList([transition1, transition2])
self.portal.portal_types.Folder.setTypeWorkflowList(['wf'])
doc = self.portal.newContent(portal_type='Folder', id='test_doc')
self.assertEqual([transition1, transition2], state1.getDestinationValueList())
......@@ -231,6 +229,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
"""
workflow = self.workflow_module.newContent(portal_type='Workflow')
state = workflow.newContent(portal_type='Workflow State', title='Some State')
state.Base_viewDict()
transition = workflow.newContent(portal_type='Workflow Transition',
title='Some Transition')
transition.setReference('change_something')
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testERP5Workflow</string> </value>
......@@ -53,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -72,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -81,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -160,7 +160,7 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor):
portal_type='Category')
def test_editWithoutModifyPortalContent(self):
edit = guarded_getattr(self.folder, 'edit')
_ = guarded_getattr(self.folder, 'edit')
original_permission_list = self.folder.permission_settings('Modify portal content')
assert len(original_permission_list) == 1
self.folder.manage_permission('Modify portal content', [], 0)
......
......@@ -416,9 +416,9 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor):
# Create some objects
self.assertEqual(self.folder.getIdGenerator(), '')
self.assertEqual(len(self.folder), 0)
obj1 = self.newContent(id=obj1_id)
obj2 = self.newContent(id=obj2_id)
obj3 = self.newContent(id=obj3_id)
self.newContent(id=obj1_id)
self.newContent(id=obj2_id)
self.newContent(id=obj3_id)
self.tic()
# call migration script
self.folder.migrateToHBTree()
......
......@@ -26,13 +26,11 @@
#
##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.utils import createZODBPythonScript
class TestGeographicalAddress(ERP5TypeTestCase):
"""
ERP5 Geographical Address related tests.
......@@ -41,7 +39,6 @@ class TestGeographicalAddress(ERP5TypeTestCase):
on a Geographical Address returns the standard text format.
"""
run_all_test = 1
entity_portal_type = 'Person'
address_portal_type = 'Address'
street_address_text = "rue Truc"
......@@ -49,37 +46,7 @@ class TestGeographicalAddress(ERP5TypeTestCase):
zip_code_text = "12345"
city_text = "City1"
def getTitle(self):
return "Geographical Address"
def getBusinessTemplateList(self):
"""
"""
return ('erp5_base', )
def login(self, quiet=0, run=run_all_test):
uf = self.getPortal().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, run=run_all_test):
self.login()
self.portal = self.getPortal()
def afterSetUp(self):
self.category_tool = self.getCategoryTool()
self.createCategories()
......@@ -91,7 +58,7 @@ class TestGeographicalAddress(ERP5TypeTestCase):
region_category_list = ['country1', 'country2', ]
if len(self.category_tool.region.contentValues()) == 0 :
for category_id in region_category_list:
o = self.category_tool.region.newContent(portal_type='Category',
self.category_tool.region.newContent(portal_type='Category',
id=category_id,
title=category_id.capitalize())
self.region_category_list = ['region/%s' % x for x \
......@@ -101,7 +68,7 @@ class TestGeographicalAddress(ERP5TypeTestCase):
"""
Create an entity
"""
portal = self.getPortal()
portal = self.portal
module = portal.getDefaultModule(self.entity_portal_type)
entity = module.newContent(portal_type=self.entity_portal_type)
sequence.edit(
......@@ -141,12 +108,10 @@ class TestGeographicalAddress(ERP5TypeTestCase):
self.zip_code_text,
self.city_text,))
def test_01_standardAddress(self, quiet=0, run=run_all_test):
def test_01_standardAddress(self):
"""
Test property existence
"""
if not run: return
sequence_list = SequenceList()
sequence_string = '\
CreateEntity \
......@@ -161,7 +126,7 @@ class TestGeographicalAddress(ERP5TypeTestCase):
"""
This script returns a different address format.
"""
createZODBPythonScript(self.getPortal().portal_skins.custom,
createZODBPythonScript(self.portal.portal_skins.custom,
'Address_asText', '', """
return '%s\\n%s %s COUNTRY' % \\
(context.getStreetAddress(),
......@@ -180,12 +145,10 @@ return '%s\\n%s %s COUNTRY' % \\
self.zip_code_text,
self.city_text))
def test_02_asTextScript(self, quiet=0, run=run_all_test):
def test_02_asTextScript(self):
"""
Test property existence
"""
if not run: return
sequence_list = SequenceList()
sequence_string = '\
CreateEntity \
......@@ -197,7 +160,3 @@ return '%s\\n%s %s COUNTRY' % \\
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestGeographicalAddress))
return suite
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testGeographicalAddress</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testGeographicalAddress</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testGeographicalAddress</string> </value>
......@@ -37,10 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 80, 2: Arguments number differs from overridden \'afterSetUp\' method (arguments-differ)</string>
<string>W: 94, 8: Unused variable \'o\' (unused-variable)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -50,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -69,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -78,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -173,7 +173,7 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
def _setUpLastMaxIdDict(self, id_generator_reference):
def countup(id_generator, id_group, until):
for i in xrange(until + 1):
for _ in xrange(until + 1):
self.id_tool.generateNewId(id_generator=id_generator_reference,
id_group=id_group)
......@@ -251,14 +251,14 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
self._setUpLastMaxIdDict(id_generator_reference)
# test migration: PersistentMapping to OOBTree
self.assertTrue(isinstance(last_id_dict, PersistentMapping))
self.assertIsInstance(last_id_dict, PersistentMapping)
self._assertIdGeneratorLastMaxIdDict(id_generator)
id_generator.rebuildGeneratorIdDict() # migrate the dict
self._assertIdGeneratorLastMaxIdDict(id_generator)
# test migration: OOBTree to OOBTree. this changes nothing, just to be sure
last_id_dict = self._getLastIdDict(id_generator)
self.assertTrue(isinstance(last_id_dict, OOBTree))
self.assertIsInstance(last_id_dict, OOBTree)
self._assertIdGeneratorLastMaxIdDict(id_generator)
id_generator.rebuildGeneratorIdDict() # migrate the dict
self._assertIdGeneratorLastMaxIdDict(id_generator)
......@@ -268,8 +268,8 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
'SQL Non Continuous Increasing Id Generator':
self._setLastIdDict(id_generator, OOBTree()) # set empty one
last_id_dict = self._getLastIdDict(id_generator)
assert(len(last_id_dict), 0) # 0 because it is empty
self.assertTrue(isinstance(last_id_dict, OOBTree))
self.assertEqual(len(last_id_dict), 0) # 0 because it is empty
self.assertIsInstance(last_id_dict, OOBTree)
# migrate the dict totally from sql table in this case
id_generator.rebuildGeneratorIdDict()
self._assertIdGeneratorLastMaxIdDict(id_generator)
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testIdToolUpgrade</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testIdToolUpgrade</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testIdToolUpgrade</string> </value>
......@@ -37,13 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W:141, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)</string>
<string>W:142, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)</string>
<string>W:143, 0: Bad indentation. Found 12 spaces, expected 8 (bad-indentation)</string>
<string>W:176, 10: Unused variable \'i\' (unused-variable)</string>
<string>W:271, 6: Assert called on a 2-uple. Did you mean \'assert x,y\'? (assert-on-tuple)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -53,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -72,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -81,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -35,6 +35,7 @@ from Products.ERP5Type.Base import _aq_reset
from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Workflow import addWorkflowByType
class TestInteractionWorkflow(ERP5TypeTestCase):
portal_type = 'Organisation'
......@@ -78,11 +79,9 @@ class TestInteractionWorkflow(ERP5TypeTestCase):
return addWorkflowByType(wf_tool, "interaction_workflow", wf_id)
def createInteractionWorkflow(self):
id = 'test_workflow'
wf_type = "interaction_workflow"
if getattr(self.getWorkflowTool(), id, None) is None:
self._createInteractionWorkflowWithId(id)
wf = self.getWorkflowTool()[id]
if getattr(self.getWorkflowTool(), 'test_workflow', None) is None:
self._createInteractionWorkflowWithId('test_workflow')
wf = self.getWorkflowTool()['test_workflow']
self.wf = wf
if getattr(wf.scripts, 'afterEdit', None) is None:
wf.scripts.manage_addProduct['PythonScripts']\
......@@ -96,9 +95,7 @@ class TestInteractionWorkflow(ERP5TypeTestCase):
_aq_reset() # XXX Fails XXX _setLastId not found when doing newContent
def createInteractionWorkflowWithTwoInteractions(self):
id = 'test_workflow'
wf_type = "interaction_workflow (Web-configurable interaction workflow)"
wf = self._createInteractionWorkflowWithId(id)
wf = self._createInteractionWorkflowWithId('test_workflow')
self.wf = wf
wf.scripts.manage_addProduct['PythonScripts']\
.manage_addPythonScript(id='afterEditA')
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testInteractionWorkflow</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testInteractionWorkflow</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testInteractionWorkflow</string> </value>
......@@ -37,12 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 82, 4: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W: 83, 4: Unused variable \'wf_type\' (unused-variable)</string>
<string>W:100, 4: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:101, 4: Unused variable \'wf_type\' (unused-variable)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -52,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -71,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -80,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -26,34 +26,14 @@
#
##############################################################################
import unittest
from AccessControl.SecurityManagement import newSecurityManager
import json
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
import json
class TestIntrospectionTool(ERP5TypeTestCase):
def getBusinessTemplateList(self):
""" """
return ('erp5_base',)
def afterSetUp(self):
self.portal = self.getPortal()
self.login()
def login(self):
uf = self.getPortal().acl_users
uf._doAddUser('seb', '', ['Manager'], [])
uf._doAddUser('ERP5TypeTestCase', '', ['Manager'], [])
user = uf.getUserById('seb').__of__(uf)
newSecurityManager(None, user)
def test_getSystemSignatureJSON(self):
"""
Test
"""
signature_json = self.portal.portal_introspections.getSystemSignatureAsJSON()
signature_by_json = json.loads(signature_json)
signature = self.portal.portal_introspections.getSystemSignatureDict()
......@@ -62,7 +42,3 @@ class TestIntrospectionTool(ERP5TypeTestCase):
for key in signature:
self.assertEqual(signature[key], signature_by_json[key])
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestIntrospectionTool))
return suite
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testIntrospectionTool</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testIntrospectionTool</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testIntrospectionTool</string> </value>
......@@ -37,9 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 46, 2: Arguments number differs from overridden \'login\' method (arguments-differ)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -49,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -68,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -77,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -150,7 +150,7 @@ class TestLocalizer(ERP5TypeTestCase):
{'fr':"C'est 1€.", 'note':'',})
localizer = portal.Localizer
test_script = createZODBPythonScript(portal.portal_skins.custom,
createZODBPythonScript(portal.portal_skins.custom,
'test_script', '', """
def assertEquals(a, b):
if a != b:
......@@ -191,7 +191,6 @@ assertEquals("This is 1€.", context.Base_translateString("This is 1€."))
value (e.g. the original message) must be returned
"""
message = " This is 1€ non-translated "
localizer = self.portal.Localizer
# Base_translateString == Localizer.translate() currently, which calls
# zope.i18n.translate and sets 'default' to 'message' before passing it to
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testLocalizer</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5Type.tests.testLocalizer</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testLocalizer</string> </value>
......@@ -37,10 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W:153, 4: Unused variable \'test_script\' (unused-variable)</string>
<string>W:194, 4: Unused variable \'localizer\' (unused-variable)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -50,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -69,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -78,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -74,11 +74,8 @@ class TestMemcachedTool(ERP5TypeTestCase):
self.tic()
def afterSetUp(self):
self.login()
def login(self):
uf = self.portal.acl_users
uf._doAddUser('vincent', '', ['Manager'], [])
uf._doAddUser('vincent', self.newPassword(), ['Manager'], [])
user = uf.getUserById('vincent').__of__(uf)
newSecurityManager(None, user)
......@@ -104,6 +101,7 @@ class TestMemcachedTool(ERP5TypeTestCase):
memcached_tool = self.portal.portal_memcached
try:
import memcache
del memcache
except ImportError:
# MemcachedTool should be disabled
self.assertRaises(RuntimeError, memcached_tool.getMemcachedDict)
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testMemcachedTool</string> </value>
......@@ -43,10 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 79, 2: Arguments number differs from overridden \'login\' method (arguments-differ)</string>
<string>W:106, 6: Unused variable \'memcache\' (unused-variable)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -56,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -75,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -84,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -39,12 +39,9 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
def getBusinessTemplateList(self):
return ('erp5_base',)
def createUser(self, name, role_list):
self.portal.acl_users._doAddUser(name, self.newPassword(), role_list, [])
def afterSetUp(self):
self.createUser('erp5user', ['Auditor', 'Author'])
self.createUser('manager', ['Manager'])
self.portal.acl_users._doAddUser('erp5user', self.newPassword(), ['Auditor', 'Author'], [])
self.portal.acl_users._doAddUser('manager', self.newPassword(), ['Manager'], [])
self.portal.email_from_address = 'site@example.invalid'
self.loginByUserName('erp5user')
......@@ -130,7 +127,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
text_content_substitution_mapping_method_id=
'NotificationMessage_getDummySubstitionMapping')
mime, text = doc.convert('txt',
_, text = doc.convert('txt',
substitution_method_parameter_dict=dict(a='b'))
self.assertEqual('substitution text: b', text.rstrip())
......@@ -148,7 +145,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
text_content_substitution_mapping_method_id=
'NotificationMessage_getDummySubstitionMapping')
mime, text = doc.convert('txt')
_, text = doc.convert('txt')
self.assertEqual('substitution text: b', text.rstrip())
def test_safe_substitution_content(self):
......@@ -167,7 +164,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
text_content_substitution_mapping_method_id=
'NotificationMessage_getDummySubstitionMapping')
mime, text = doc.convert('txt')
_, text = doc.convert('txt')
self.assertEqual('substitution text: ${b}', text.rstrip())
self.assertEqual('${b}', doc.asSubjectText())
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testNotificationMessageModule</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testNotificationMessageModule</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testNotificationMessageModule</string> </value>
......@@ -37,12 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 49, 2: Arguments number differs from overridden \'createUser\' method (arguments-differ)</string>
<string>W:149, 4: Unused variable \'mime\' (unused-variable)</string>
<string>W:168, 4: Unused variable \'mime\' (unused-variable)</string>
<string>W:187, 4: Unused variable \'mime\' (unused-variable)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -52,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -71,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -80,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -38,7 +38,7 @@ from email.header import decode_header, make_header
from email.utils import parseaddr
# Copied from ERP5Type/patches/CMFMailIn.py
def decode_email(file):
def decode_email(file_):
# Prepare result
theMail = {
'attachment_list': [],
......@@ -47,9 +47,9 @@ def decode_email(file):
'headers': {}
}
# Get Message
msg = email.message_from_string(file)
msg = email.message_from_string(file_)
# Back up original file
theMail['__original__'] = file
theMail['__original__'] = file_
# Recode headers to UTF-8 if needed
for key, value in msg.items():
decoded_value_list = decode_header(value)
......@@ -107,7 +107,7 @@ class TestNotificationTool(ERP5TypeTestCase):
def getTitle(self):
return "Notification Tool"
def createUser(self, name, role_list):
def createUser(self, name, role_list): # pylint:disable=arguments-differ
user_folder = self.getPortal().acl_users
user_folder._doAddUser(name, 'password', role_list, [])
......@@ -196,8 +196,8 @@ class TestNotificationTool(ERP5TypeTestCase):
self.portal.portal_notifications.sendMessage(
recipient=sequence['user_a_id'], subject='Subject', message='Message')
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
mfrom, mto, messageText = last_message
self.assertNotEqual(last_message, ())
mfrom, mto, _ = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userA@example.invalid'], mto)
......@@ -236,8 +236,8 @@ class TestNotificationTool(ERP5TypeTestCase):
self.portal.portal_notifications.sendMessage(
subject='Subject', message='Message')
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
mfrom, mto, messageText = last_message
self.assertNotEqual(last_message, ())
mfrom, mto, _ = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['site@example.invalid'], mto)
......@@ -249,8 +249,8 @@ class TestNotificationTool(ERP5TypeTestCase):
self.portal.portal_notifications.sendMessage(
recipient=sequence['user_a_id'], subject='Subject', )
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
mfrom, mto, messageText = last_message
self.assertNotEqual(last_message, ())
mfrom, mto, _ = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userA@example.invalid'], mto)
......@@ -272,7 +272,7 @@ class TestNotificationTool(ERP5TypeTestCase):
self.portal.portal_notifications.sendMessage(
recipient=sequence['user_a_id'], subject='Subject', message='Message')
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
self.assertNotEqual(last_message, ())
mfrom, mto, messageText = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userA@example.invalid'], mto)
......@@ -313,7 +313,7 @@ class TestNotificationTool(ERP5TypeTestCase):
])
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
self.assertNotEqual(last_message, ())
mfrom, mto, messageText = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userA@example.invalid'], mto)
......@@ -345,14 +345,14 @@ class TestNotificationTool(ERP5TypeTestCase):
recipient=[sequence['user_a_id'], sequence['user_b_id']], subject='Subject', message='Message')
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
mfrom, mto, messageText = last_message
self.assertNotEqual(last_message, ())
mfrom, mto, _ = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userB@example.invalid'], mto)
previous_message = self.portal.MailHost._previous_message
self.assertNotEquals((), previous_message)
mfrom, mto, messageText = previous_message
self.assertNotEqual(last_message, ())
mfrom, mto, _ = previous_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userA@example.invalid'], mto)
......@@ -400,7 +400,7 @@ class TestNotificationTool(ERP5TypeTestCase):
self.portal.portal_notifications.sendMessage(
recipient=person.getObject(), subject='Subject', message='Message')
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
self.assertNotEqual(last_message, ())
mfrom, mto, messageText = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userA@example.invalid'], mto)
......@@ -434,7 +434,7 @@ Yes, I will go."""
recipient=sequence['user_a_id'], subject='Subject',
message_text_format='text/plain', message=message)
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
self.assertNotEqual(last_message, ())
mfrom, mto, messageText = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userA@example.invalid'], mto)
......@@ -493,7 +493,7 @@ Yes, I will go."""
self.portal.portal_notifications.sendMessage(
recipient=sequence['user_a_id'], subject='Subject', message='Message')
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
self.assertNotEqual(last_message, ())
def test_permission_on_recipient_not_needed(self):
"""Notification Tool can be used to send Messages even when user does not
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testNotificationTool</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testNotificationTool</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testNotificationTool</string> </value>
......@@ -37,15 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 64, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)</string>
<string>W: 41, 17: Redefining built-in \'file\' (redefined-builtin)</string>
<string>W:110, 2: Arguments number differs from overridden \'createUser\' method (arguments-differ)</string>
<string>W:200, 16: Unused variable \'messageText\' (unused-variable)</string>
<string>W:240, 16: Unused variable \'messageText\' (unused-variable)</string>
<string>W:253, 16: Unused variable \'messageText\' (unused-variable)</string>
<string>W:349, 16: Unused variable \'messageText\' (unused-variable)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -55,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -74,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -83,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -29,7 +29,6 @@
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.Sequence import SequenceList
from erp5.component.tool.SessionTool import SESSION_CACHE_FACTORY
from string import letters as LETTERS
......@@ -47,27 +46,6 @@ class TestSessionTool(ERP5TypeTestCase):
session_id = "123456789"
def getTitle(self):
return "Session Tool"
def afterSetUp(self):
# create a Memcached Plugin
memcached_tool = self.portal.portal_memcached
#create Memcache Plugin
if getattr(memcached_tool, 'default_memcached_plugin', None) is None:
memcached_tool.newContent(id='default_memcached_plugin',
portal_type='Memcached Plugin',
int_index=0,
url_string='127.0.0.1:11211')
self.login()
def login(self):
uf = self.portal.acl_users
uf._doAddUser('ivan', '', ['Manager'], [])
uf._doAddUser('ERP5TypeTestCase', '', ['Manager'], [])
user = uf.getUserById('ivan').__of__(uf)
newSecurityManager(None, user)
def _changeCachePlugin(self, portal_type, storage_duration = 86400):
""" Change current cache plugin with new one. """
portal_caches = self.portal.portal_caches
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testSessionTool</string> </value>
......@@ -43,9 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 70, 2: Arguments number differs from overridden \'login\' method (arguments-differ)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -55,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -74,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -83,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -75,4 +75,4 @@ class TestTimeout(ERP5TypeTestCase):
with Deadline(1.0):
time.sleep(2)
with self.assertRaises(TimeoutReachedError):
[x.getObject() for x in self.portal.portal_templates.searchFolder()]
_ = [x.getObject() for x in self.portal.portal_templates.searchFolder()]
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testTimeout</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5Type.tests.testTimeout</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testTimeout</string> </value>
......@@ -37,9 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 78, 8: Expression "[x.getObject() for x in self.portal.portal_templates.searchFolder()]" is assigned to nothing (expression-not-assigned)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -49,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -68,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -77,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -26,14 +26,12 @@
#
##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager, \
noSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.ZopeGuards import guarded_apply, guarded_getattr
from zExceptions import Unauthorized
class TestTimerService(ERP5TypeTestCase):
"""
Test TimerService-related features. Maybe this should be put in TimerService
......@@ -41,20 +39,6 @@ class TestTimerService(ERP5TypeTestCase):
idea to put an ERP5-type test in it.
"""
def getTitle(self):
return "TimerService"
def getBusinessTemplateList(self):
"""
"""
return ()
def afterSetUp(self):
uf = self.portal.acl_users
uf._doAddUser('rc', '', ['Manager'], [])
user = uf.getUserById('rc').__of__(uf)
newSecurityManager(None, user)
def test_01_checkAnonymousProcessing(self):
"""
Test whether a timer can be invoked by anonymous.
......@@ -66,11 +50,6 @@ class TestTimerService(ERP5TypeTestCase):
guarded_apply(process_timer, (0,))
except Unauthorized:
self.fail('calling process_timer is unauthorized')
except:
except Exception:
# Do not care about any exception but unauthorized.
pass
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestTimerService))
return suite
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testTimerService</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5Type.tests.testTimerService</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testTimerService</string> </value>
......@@ -37,12 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 66, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)</string>
<string>W: 68, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)</string>
<string>W: 71, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)</string>
<string>W: 69, 4: No exception type(s) specified (bare-except)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -52,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -71,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -80,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -43,7 +43,7 @@ class TestTransactionalVariable(TestCase):
tv.clear()
self.assertEqual(len(tv), 0)
with self.assertRaises(KeyError):
tv['toto']
_ = tv['toto']
tv['toto'] = 'titi'
self.assertEqual(len(tv), 1)
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testTransactionalVariable</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5Type.tests.testTransactionalVariable</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testTransactionalVariable</string> </value>
......@@ -37,56 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 34, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 36, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 37, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 39, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 43, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 44, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 45, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 46, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)</string>
<string>W: 48, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 49, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 50, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 52, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 53, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 54, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 55, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 57, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 58, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 59, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 60, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 62, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 63, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 66, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 67, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 68, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 71, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 72, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 73, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 74, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 77, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 78, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 79, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 80, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 82, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 83, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 86, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 87, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 88, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 92, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 93, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 94, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 95, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 96, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 97, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W:101, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W:102, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W:103, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W:104, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 46, 8: Statement seems to have no effect (pointless-statement)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -96,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -115,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -124,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -53,13 +53,8 @@ class TestTrashTool(ERP5TypeTestCase):
return 1
def afterSetUp(self):
self.login()
portal = self.getPortal()
catalog_tool = self.getCatalogTool()
def login(self):
uf = self.getPortal().acl_users
uf._doAddUser('seb', '', ['Manager'], [])
uf = self.portal.acl_users
uf._doAddUser('seb', self.newPassword(), ['Manager'], [])
user = uf.getUserById('seb').__of__(uf)
newSecurityManager(None, user)
......@@ -81,9 +76,8 @@ class TestTrashTool(ERP5TypeTestCase):
base_category = pc._getOb(bc_id, None)
self.assertTrue(base_category is not None)
category_list = []
for i in xrange(10):
for _ in xrange(10):
category = base_category.newContent(portal_type='Category')
self.assertTrue(category is not None)
category_list.append(category.getId())
sequence.edit(category_id_list=category_list)
......@@ -95,13 +89,13 @@ class TestTrashTool(ERP5TypeTestCase):
erp5_core = ps['erp5_core']
erp5_core.manage_addFolder(id="image")
image = erp5_core._getOb("image")
f = image.manage_addFile(id="file")
image.manage_addFile(id="file")
def stepCheckTrashToolExists(self, sequence=None, sequence_list=None, **kw):
"""
Check existence of trash tool
"""
self.assertTrue(self.getTrashTool() is not None)
self.assertIsNotNone(self.getTrashTool())
def stepCreateTrashBin(self, sequence=None, sequence_list=None, **kw):
"""
......@@ -193,11 +187,10 @@ class TestTrashTool(ERP5TypeTestCase):
trash_id = sequence.get('trash_id')
trash = self.getTrashTool()
trashbin = trash._getOb(trash_id, None)
self.assertTrue(trashbin is not None)
self.assertIsNotNone(trashbin)
# get category trash folder
bc_id = sequence.get('bc_id')
trashbin_objects_list = list(trashbin.objectValues())
self.assertTrue(len(trashbin_objects_list) > 0)
self.assertEqual(len(trashbin_objects_list), 1)
obj = trashbin_objects_list[0]
self.assertEqual(obj.getId(), 'portal_categories_items')
......@@ -215,11 +208,10 @@ class TestTrashTool(ERP5TypeTestCase):
subcat_objects_list = (cat_object.objectIds())
self.assertNotEqual(len(subcat_objects_list), 0)
categ_id_list = sequence.get('category_id_list')
for id in subcat_objects_list:
self.assertTrue(id in categ_id_list)
cat = cat_object._getOb(id, None)
self.assertTrue(cat is not None)
self.assertTrue(cat.isIndexable, 0)
for id_ in subcat_objects_list:
self.assertIn(id_, categ_id_list)
cat = cat_object._getOb(id_, None)
self.assertTrue(cat.isIndexable)
self.assertEqual(cat.getPortalType(), 'Category')
def stepCheckFolderObjectBackup(self, sequence=None, sequence_list=None, **kw):
......@@ -230,7 +222,6 @@ class TestTrashTool(ERP5TypeTestCase):
trash = self.getTrashTool()
trashbin = trash._getOb(trash_id, None)
self.assertTrue(trashbin is not None)
bc_id = sequence.get('bc_id')
trashbin_objects_list = list(trashbin.objectValues())
self.assertTrue(len(trashbin_objects_list) > 0)
self.assertEqual(len(trashbin_objects_list), 1)
......@@ -318,8 +309,6 @@ class TestTrashTool(ERP5TypeTestCase):
bc_id = sequence.get('bc_id')
pc = self.getCategoryTool()
base_category = pc._getOb(bc_id, None)
self.assertTrue(base_category is not None)
subobjects_ids = base_category.objectIds()
bc_path = base_category.getPath().split('/')[2:-1]
# check backup
backup_subobjects_ids = trash.backupObject(trashbin, bc_path, bc_id, save=1, keep_subobjects=1)
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testTrashTool</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testTrashTool</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testTrashTool</string> </value>
......@@ -37,16 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 57, 4: Unused variable \'portal\' (unused-variable)</string>
<string>W: 58, 4: Unused variable \'catalog_tool\' (unused-variable)</string>
<string>W: 60, 2: Arguments number differs from overridden \'login\' method (arguments-differ)</string>
<string>W: 84, 8: Unused variable \'i\' (unused-variable)</string>
<string>W: 98, 4: Unused variable \'f\' (unused-variable)</string>
<string>W:218, 8: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W:233, 4: Unused variable \'bc_id\' (unused-variable)</string>
<string>W:322, 4: Unused variable \'subobjects_ids\' (unused-variable)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -56,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -75,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -84,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -94,7 +94,7 @@ class TestWorkflowHistoryList(TestCase):
a = EXPECTED[item]
except IndexError:
with self.assertRaises(IndexError):
ddl[item]
_ = ddl[item]
else:
assert a != [], a
self.assertEqual(a, ddl[item])
......@@ -102,16 +102,16 @@ class TestWorkflowHistoryList(TestCase):
i = COUNT + 1
for i in xrange(-i, i):
check[i]
check[-50:10]
check[:20:3]
check[5:40]
check[32::4]
check[::-1]
check[-5::-7]
check[50:40:-1]
check[30:-50:-4]
check[:30:-3]
_ = check[i]
_ = check[-50:10]
_ = check[:20:3]
_ = check[5:40]
_ = check[32::4]
_ = check[::-1]
_ = check[-5::-7]
_ = check[50:40:-1]
_ = check[30:-50:-4]
_ = check[:30:-3]
self.assertFalse(ddl[-5:30])
self.assertFalse(ddl[30:-5:-1])
......@@ -129,8 +129,7 @@ class TestWorkflowHistoryList(TestCase):
@fixed_count_bucket
def test_01_DoublyLinkList(self):
EXPECTED = range(COUNT)
self.checkList(new(DoublyLinkList, EXPECTED))
self.checkList(new(DoublyLinkList, range(COUNT)))
@fixed_count_bucket
def test_02_LegacyWorkflowHistoryList(self):
......@@ -205,10 +204,10 @@ class TestDedup(ERP5TypeTestCase):
self.login()
deduped = []
def dedupStrings(obj):
new = orig_dedupStrings(obj)
self.assertEqual(new, obj)
deduped.append(len(new))
return new
new_obj = orig_dedupStrings(obj)
self.assertEqual(new_obj, obj)
deduped.append(len(new_obj))
return new_obj
from Products.ERP5Type import Workflow
orig_dedupStrings = Workflow.dedupStrings
try:
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testWorkflowHistoryList</string> </value>
......@@ -43,21 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 97, 12: Statement seems to have no effect (pointless-statement)</string>
<string>W:105, 6: Statement seems to have no effect (pointless-statement)</string>
<string>W:106, 4: Statement seems to have no effect (pointless-statement)</string>
<string>W:107, 4: Statement seems to have no effect (pointless-statement)</string>
<string>W:108, 4: Statement seems to have no effect (pointless-statement)</string>
<string>W:109, 4: Statement seems to have no effect (pointless-statement)</string>
<string>W:110, 4: Statement seems to have no effect (pointless-statement)</string>
<string>W:111, 4: Statement seems to have no effect (pointless-statement)</string>
<string>W:112, 4: Statement seems to have no effect (pointless-statement)</string>
<string>W:113, 4: Statement seems to have no effect (pointless-statement)</string>
<string>W:114, 4: Statement seems to have no effect (pointless-statement)</string>
<string>W:132, 4: Redefining name \'EXPECTED\' from outer scope (line 76) (redefined-outer-name)</string>
<string>W:206, 6: Redefining name \'new\' from outer scope (line 55) (redefined-outer-name)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -67,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -86,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -95,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -78,7 +78,7 @@ class TestXMLPickle(unittest.TestCase):
reconstructed_obj = pickle.loads(reconstructed_pickled_data)
self.assert_(reconstructed_obj.__class__ is DummyClass)
self.assert_(type(getattr(reconstructed_obj, 'data', None)) is list)
self.assert_(type(getattr(reconstructed_obj, 'data', None)) is list) # pylint:disable=unidiomatic-typecheck
self.assertEqual(reconstructed_obj.data[0], 1)
self.assert_(reconstructed_obj.data[1] is reconstructed_obj)
self.assert_(reconstructed_obj.data[2] is reconstructed_obj.data)
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testXMLPickle</string> </value>
......@@ -43,9 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 81, 17: Using type() instead of isinstance() for a typecheck. (unidiomatic-typecheck)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -55,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -74,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -83,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -69,19 +69,9 @@ class TestZODBHistory(ERP5TypeTestCase):
def setUpUser(self):
""" Set up a user to test normal users can use this function. """
self.addUser('tatuya')
def addUser(self, user_name, role=['Member', 'Owner', 'Assignor']):
""" Create a test user."""
uf = self.portal.acl_users
if not uf.getUserById(user_name):
uf._doAddUser(user_name, '', role, [])
def _clearCache(self):
""" Clear cache to validate the preference modification. """
self.portal.portal_caches.clearCache(
cache_factory_list=('erp5_ui_short', # for preference cache
))
if not uf.getUserById('tatuya'):
uf._doAddUser('tatuya', '', ['Member', 'Owner', 'Assignor'], [])
def test_01_testZODBHistory(self):
"""
......@@ -116,7 +106,6 @@ class TestZODBHistory(ERP5TypeTestCase):
# changes the limit to 100
preference.setPreferredHtmlStyleZodbHistorySize(100)
self._clearCache()
self.assertEqual(preference.getPreferredHtmlStyleZodbHistorySize(), 100)
history_list = org2.Base_getZODBHistoryList()
# Now that the limit is 100, thus the history page show the all history
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testZODBHistory</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testZODBHistory</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testZODBHistory</string> </value>
......@@ -37,10 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 61, 0: Bad indentation. Found 7 spaces, expected 6 (bad-indentation)</string>
<string>W: 74, 2: Dangerous default value [] as argument (dangerous-default-value)</string>
</tuple>
<tuple/>
</value>
</item>
<item>
......@@ -50,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -69,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -78,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment