Commit d10cf0da authored by Jérome Perrin's avatar Jérome Perrin

Enable coding style for erp5_core_test

See merge request nexedi/erp5!1427
parents 2cbd5640 56ece63b
Pipeline #15722 failed with stage
in 0 seconds
......@@ -100,24 +100,28 @@
</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/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</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>
......
......@@ -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>
......
......@@ -138,9 +138,9 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
bt = self.portal.portal_templates.getInstalledBusinessTemplate('erp5_core',
strict=True)
for path, obj in bt._path_item._objects.iteritems():
path, obj_id = path.rsplit('/', 1)
if path == 'portal_ids':
id_tool._setObject(obj_id, obj._getCopy(bt))
path, obj_id = path.rsplit('/', 1)
if path == 'portal_ids':
id_tool._setObject(obj_id, obj._getCopy(bt))
self.tic()
id_list = id_tool.generateNewLengthIdList(id_group='foo')
# it is known that with current upgrade there is a hole
......@@ -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)
......@@ -61,7 +61,7 @@ def decode_email(file):
'to', 'from', 'cc', 'sender', 'reply-to'):
header_field = theMail['headers'].get(header)
if header_field:
theMail['headers'][header] = parseaddr(header_field)[1]
theMail['headers'][header] = parseaddr(header_field)[1]
# Get attachments
body_found = 0
for part in msg.walk():
......@@ -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.
......@@ -63,14 +47,9 @@ class TestTimerService(ERP5TypeTestCase):
timer_service = self.app.Control_Panel.timer_service
process_timer = guarded_getattr(timer_service, 'process_timer')
try:
guarded_apply(process_timer, (0,))
guarded_apply(process_timer, (0,))
except Unauthorized:
self.fail('calling process_timer is unauthorized')
except:
# Do not care about any exception but unauthorized.
pass
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestTimerService))
return suite
self.fail('calling process_timer is unauthorized')
except Exception:
# Do not care about any exception but unauthorized.
pass
......@@ -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)
......
......@@ -48,7 +48,6 @@ test.erp5.testQueryModule
test.erp5.testRestrictedPythonSecurity
test.erp5.testSelectionTool
test.erp5.testSessionTool
test.erp5.testSQLCachedWorklist
test.erp5.testTimeout
test.erp5.testTimerService
test.erp5.testTransactionalVariable
......
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