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

core_test: address pylint messages and other small cleanups

parent a148fcc9
...@@ -100,24 +100,28 @@ ...@@ -100,24 +100,28 @@
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>validate</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>validate</string> </value>
<key> <string>validation_state</string> </key> </item>
<value> <string>validated</string> </value> <item>
</item> <key> <string>validation_state</string> </key>
</dictionary> <value> <string>validated</string> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
...@@ -79,7 +79,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -79,7 +79,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
""" """
return ('erp5_base',) return ('erp5_base',)
def login(self): def login(self): # pylint:disable=arguments-differ
uf = self.getPortal().acl_users uf = self.getPortal().acl_users
uf._doAddUser(self.username, '', ['Manager'], []) uf._doAddUser(self.username, '', ['Manager'], [])
user = uf.getUserById(self.username).__of__(uf) user = uf.getUserById(self.username).__of__(uf)
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testBase</string> </value> <value> <string>testBase</string> </value>
...@@ -43,11 +49,7 @@ ...@@ -43,11 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <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>
</value> </value>
</item> </item>
<item> <item>
...@@ -57,13 +59,28 @@ ...@@ -57,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -76,7 +93,7 @@ ...@@ -76,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -85,7 +102,7 @@ ...@@ -85,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -49,51 +49,7 @@ ...@@ -49,51 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <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>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -65,8 +65,7 @@ class TestRamCache(ERP5TypeTestCase): ...@@ -65,8 +65,7 @@ class TestRamCache(ERP5TypeTestCase):
test_scopes.sort() test_scopes.sort()
## remove DistributedRamCache since it's a flat storage ## remove DistributedRamCache since it's a flat storage
filtered_cache_plugins = filter( filtered_cache_plugins = [x for x in self.cache_plugins if not isinstance(x, DistributedRamCache)]
lambda x: not isinstance(x, DistributedRamCache), self.cache_plugins)
for cache_plugin in filtered_cache_plugins: for cache_plugin in filtered_cache_plugins:
if not self.quiet: if not self.quiet:
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testCache</string> </value> <value> <string>testCache</string> </value>
...@@ -43,9 +49,7 @@ ...@@ -43,9 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 68, 29: map/filter on lambda could be replaced by comprehension (deprecated-lambda)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -55,13 +59,28 @@ ...@@ -55,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -74,7 +93,7 @@ ...@@ -74,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -83,7 +102,7 @@ ...@@ -83,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -65,7 +65,7 @@ class TestCacheTool(ERP5TypeTestCase): ...@@ -65,7 +65,7 @@ class TestCacheTool(ERP5TypeTestCase):
self.createCachedMethod() self.createCachedMethod()
self.commit() self.commit()
def login(self): def login(self): # pylint:disable=arguments-differ
uf = self.portal.acl_users uf = self.portal.acl_users
uf._doAddUser('admin', '', ['Manager'], []) uf._doAddUser('admin', '', ['Manager'], [])
uf._doAddUser('ERP5TypeTestCase', '', ['Manager'], []) uf._doAddUser('ERP5TypeTestCase', '', ['Manager'], [])
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testCacheTool</string> </value> <value> <string>testCacheTool</string> </value>
...@@ -43,9 +49,7 @@ ...@@ -43,9 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 68, 2: Arguments number differs from overridden \'login\' method (arguments-differ)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -55,13 +59,28 @@ ...@@ -55,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -74,7 +93,7 @@ ...@@ -74,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -83,7 +102,7 @@ ...@@ -83,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -57,7 +57,7 @@ class TestCachedSkinsTool(ERP5TypeTestCase): ...@@ -57,7 +57,7 @@ class TestCachedSkinsTool(ERP5TypeTestCase):
# Use None as skinname to keep using the default one. # Use None as skinname to keep using the default one.
self.getSkinnableObject().changeSkin(skinname=None) self.getSkinnableObject().changeSkin(skinname=None)
def login(self): def login(self): # pylint:disable=arguments-differ
uf = self.portal.acl_users uf = self.portal.acl_users
uf._doAddUser('vincent', '', ['Manager'], []) uf._doAddUser('vincent', '', ['Manager'], [])
user = uf.getUserById('vincent').__of__(uf) user = uf.getUserById('vincent').__of__(uf)
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testCachedSkinsTool</string> </value> <value> <string>testCachedSkinsTool</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5Type.tests.testCachedSkinsTool</string> </value> <value> <string>Products.ERP5Type.tests.testCachedSkinsTool</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testCachedSkinsTool</string> </value> <value> <string>test.erp5.testCachedSkinsTool</string> </value>
...@@ -37,9 +49,7 @@ ...@@ -37,9 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 60, 2: Arguments number differs from overridden \'login\' method (arguments-differ)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -49,13 +59,28 @@ ...@@ -49,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -68,7 +93,7 @@ ...@@ -68,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -77,7 +102,7 @@ ...@@ -77,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -49,7 +49,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -49,7 +49,7 @@ class TestConstraint(PropertySheetTestCase):
""" """
return ('erp5_base',) return ('erp5_base',)
def login(self): def login(self): # pylint:disable=arguments-differ
uf = self.portal.acl_users uf = self.portal.acl_users
uf._doAddUser('rc', '', ['Manager'], []) uf._doAddUser('rc', '', ['Manager'], [])
user = uf.getUserById('rc').__of__(uf) user = uf.getUserById('rc').__of__(uf)
...@@ -114,26 +114,24 @@ class TestConstraint(PropertySheetTestCase): ...@@ -114,26 +114,24 @@ class TestConstraint(PropertySheetTestCase):
Create a object which will be tested. Create a object which will be tested.
""" """
module = self.portal.getDefaultModule(self.object_portal_type) module = self.portal.getDefaultModule(self.object_portal_type)
object = module.newContent(portal_type=self.object_portal_type) document = module.newContent(portal_type=self.object_portal_type)
group1 = object.portal_categories.restrictedTraverse('group/testGroup1') group1 = document.portal_categories.restrictedTraverse('group/testGroup1')
if sequence: if sequence:
sequence.edit( sequence.edit(
object=object, document=document,
group=group1, group=group1,
) )
return object return document
def stepSetObjectGroup(self, sequence=None, def stepSetObjectGroup(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
Set a group to object Set a group to object
""" """
object = sequence.get('object') document = sequence.get('document')
# group1 = object.portal_categories.restrictedTraverse('group/testGroup1') document.edit(group='testGroup1')
# object.edit(group_value=group1)
object.edit(group='testGroup1')
self.assertNotEqual( self.assertNotEqual(
object.getGroup(portal_type=()), document.getGroup(portal_type=()),
None ) None )
def stepSetObjectGroupOrganisation(self, sequence=None, def stepSetObjectGroupOrganisation(self, sequence=None,
...@@ -141,11 +139,11 @@ class TestConstraint(PropertySheetTestCase): ...@@ -141,11 +139,11 @@ class TestConstraint(PropertySheetTestCase):
""" """
Set a group to object, forcing portal_type color to Organisation Set a group to object, forcing portal_type color to Organisation
""" """
object = sequence.get('object') document = sequence.get('document')
object.setGroup(object.getRelativeUrl(), document.setGroup(document.getRelativeUrl(),
portal_type='Organisation') portal_type='Organisation')
self.assertNotEqual( self.assertNotEqual(
object.getGroup(portal_type='Organisation'), document.getGroup(portal_type='Organisation'),
None ) None )
def stepSetObjectGroupList(self, sequence=None, def stepSetObjectGroupList(self, sequence=None,
...@@ -153,68 +151,65 @@ class TestConstraint(PropertySheetTestCase): ...@@ -153,68 +151,65 @@ class TestConstraint(PropertySheetTestCase):
""" """
Set a group to object Set a group to object
""" """
object = sequence.get('object') document = sequence.get('document')
# group1 = object.portal_categories.restrictedTraverse('group/testGroup1') document.edit(group_list=['testGroup1', 'testGroup2'])
# group2 = object.portal_categories.restrictedTraverse('group/testGroup2')
# object.edit(group_value_list=[group1, group2])
object.edit(group_list=['testGroup1', 'testGroup2'])
def stepSetObjectTitle(self, sequence=None, def stepSetObjectTitle(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
Set a different title value Set a different title value
""" """
object = sequence.get('object') document = sequence.get('document')
object_title = self.object_title object_title = self.object_title
object.setTitle(object_title) document.setTitle(object_title)
def stepSetObjectNoneTitle(self, sequence=None, def stepSetObjectNoneTitle(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
Set a different title value 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 # Do not call edit, as we want to explicitely modify the property
# (and edit modify only if value is different) # (and edit modify only if value is different)
object.setTitle(None) document.setTitle(None)
def stepSetObjectEmptyTitle(self, sequence=None, def stepSetObjectEmptyTitle(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
Set a different title value 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 # Do not call edit, as we want to explicitely modify the property
# (and edit modify only if value is different) # (and edit modify only if value is different)
object.setTitle('') document.setTitle('')
def stepSetObjectIntTitle(self, sequence=None, def stepSetObjectIntTitle(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
Set a different title value Set a different title value
""" """
object = sequence.get('object') document = sequence.get('document')
object.edit(title=12345) document.edit(title=12345)
def stepSetObjectBadTypedProperty(self, sequence=None, def stepSetObjectBadTypedProperty(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
Set a property with a bad type Set a property with a bad type
""" """
object = sequence.get('object') document = sequence.get('document')
property_name = 'ean13code' property_name = 'ean13code'
# make sure the property is defined on the object # make sure the property is defined on the document
self.assertTrue(not object.hasProperty(property_name)) self.assertTrue(not document.hasProperty(property_name))
self.assertTrue(object.getPropertyType(property_name) != 'int') self.assertTrue(document.getPropertyType(property_name) != 'int')
object.setProperty(property_name, 12) document.setProperty(property_name, 12)
def stepSetObjectIntLocalProperty(self, sequence=None, def stepSetObjectIntLocalProperty(self, sequence=None,
sequence_list=None, **kw): 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') document = sequence.get('document')
object.edit(local_prop = 12345) document.edit(local_prop = 12345)
def _createGenericConstraint(self, sequence=None, klass_name='Constraint', def _createGenericConstraint(self, sequence=None, klass_name='Constraint',
**kw): **kw):
...@@ -225,9 +220,7 @@ class TestConstraint(PropertySheetTestCase): ...@@ -225,9 +220,7 @@ class TestConstraint(PropertySheetTestCase):
module = Constraint module = Constraint
file_path = "%s.%s" % (module.__name__, klass_name) file_path = "%s.%s" % (module.__name__, klass_name)
__import__(file_path) __import__(file_path)
file = getattr(module, klass_name) klass = getattr(module, klass_name)
klass = file
# klass = getattr(file, klass_name)
constraint = klass(**kw) constraint = klass(**kw)
if sequence is not None: if sequence is not None:
sequence.edit(constraint=constraint,) sequence.edit(constraint=constraint,)
...@@ -238,10 +231,10 @@ class TestConstraint(PropertySheetTestCase): ...@@ -238,10 +231,10 @@ class TestConstraint(PropertySheetTestCase):
""" """
Call checkConsistency of a Constraint. Call checkConsistency of a Constraint.
""" """
object = sequence.get('object') document = sequence.get('document')
constraint = sequence.get('constraint') constraint = sequence.get('constraint')
# Check # Check
error_list = constraint.checkConsistency(object) error_list = constraint.checkConsistency(document)
sequence.edit( sequence.edit(
error_list=error_list error_list=error_list
) )
...@@ -251,10 +244,10 @@ class TestConstraint(PropertySheetTestCase): ...@@ -251,10 +244,10 @@ class TestConstraint(PropertySheetTestCase):
""" """
Call checkConsistency of a Constraint, fixing the errors. Call checkConsistency of a Constraint, fixing the errors.
""" """
object = sequence.get('object') document = sequence.get('document')
constraint = sequence.get('constraint') constraint = sequence.get('constraint')
# Check # Check
error_list = constraint.checkConsistency(object, fixit=1) error_list = constraint.checkConsistency(document, fixit=1)
sequence.edit( sequence.edit(
error_list=error_list error_list=error_list
) )
...@@ -264,10 +257,10 @@ class TestConstraint(PropertySheetTestCase): ...@@ -264,10 +257,10 @@ class TestConstraint(PropertySheetTestCase):
""" """
Call checkConsistency of a Constraint. Call checkConsistency of a Constraint.
""" """
object = sequence.get('group') document = sequence.get('group')
constraint = sequence.get('constraint') constraint = sequence.get('constraint')
# Check # Check
error_list = constraint.checkConsistency(object) error_list = constraint.checkConsistency(document)
sequence.edit( sequence.edit(
error_list=error_list error_list=error_list
) )
...@@ -1327,8 +1320,8 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1327,8 +1320,8 @@ class TestConstraint(PropertySheetTestCase):
""" """
Create a Content Object inside one Object Create a Content Object inside one Object
""" """
object = sequence.get('object') document = sequence.get('document')
content_object = object.newContent(portal_type=self.object_content_portal_type) content_object = document.newContent(portal_type=self.object_content_portal_type)
sequence.edit( sequence.edit(
content_object = content_object, content_object = content_object,
) )
...@@ -1373,20 +1366,20 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1373,20 +1366,20 @@ class TestConstraint(PropertySheetTestCase):
""" """
Set valid Title to Object Set valid Title to Object
""" """
object = sequence.get('object') document = sequence.get('document')
object.setTitle(self.object_title) document.setTitle(self.object_title)
sequence.edit( sequence.edit(
object = object, document = document,
) )
def stepSetObjectTitle1(self, sequence=None, sequence_list=None, **kw): def stepSetObjectTitle1(self, sequence=None, sequence_list=None, **kw):
""" """
Set empty (or invalid string) to Object Set empty (or invalid string) to Object
""" """
object = sequence.get('object') document = sequence.get('document')
object.setTitle(' ') document.setTitle(' ')
sequence.edit( sequence.edit(
object = object, document = document,
) )
def test_StringAttributeMatchConstraint(self): def test_StringAttributeMatchConstraint(self):
...@@ -1527,13 +1520,13 @@ class TestConstraint(PropertySheetTestCase): ...@@ -1527,13 +1520,13 @@ class TestConstraint(PropertySheetTestCase):
def stepValidateObject(self, sequence=None, sequence_list=None, **kw): def stepValidateObject(self, sequence=None, sequence_list=None, **kw):
""" """
""" """
document = sequence.get('object') document = sequence.get('document')
document.validate() document.validate()
def stepInvalidateObject(self, sequence=None, sequence_list=None, **kw): def stepInvalidateObject(self, sequence=None, sequence_list=None, **kw):
""" """
""" """
document = sequence.get('object') document = sequence.get('document')
document.invalidate() document.invalidate()
def stepCreateAttributeUnicityConstraint(self, sequence=None, def stepCreateAttributeUnicityConstraint(self, sequence=None,
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testConstraint</string> </value> <value> <string>testConstraint</string> </value>
...@@ -43,26 +49,7 @@ ...@@ -43,26 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <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>
</value> </value>
</item> </item>
<item> <item>
...@@ -72,13 +59,28 @@ ...@@ -72,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -91,7 +93,7 @@ ...@@ -91,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -100,7 +102,7 @@ ...@@ -100,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
import unittest import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
class TestERP5Category(ERP5TypeTestCase): class TestERP5Category(ERP5TypeTestCase):
...@@ -64,7 +64,6 @@ class TestERP5Category(ERP5TypeTestCase): ...@@ -64,7 +64,6 @@ class TestERP5Category(ERP5TypeTestCase):
return self.getSalePackingListModule()['1'] return self.getSalePackingListModule()['1']
def afterSetUp(self): def afterSetUp(self):
self.login()
# This add the base category size # This add the base category size
portal_categories = self.getCategoryTool() portal_categories = self.getCategoryTool()
person_module = self.getPersonModule() person_module = self.getPersonModule()
...@@ -155,12 +154,6 @@ class TestERP5Category(ERP5TypeTestCase): ...@@ -155,12 +154,6 @@ class TestERP5Category(ERP5TypeTestCase):
self.commitAndTic() 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): def commitAndTic(self):
"""Just to save one line. """Just to save one line.
""" """
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testERP5Category</string> </value> <value> <string>testERP5Category</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testERP5Category</string> </value> <value> <string>Products.ERP5.tests.testERP5Category</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testERP5Category</string> </value> <value> <string>test.erp5.testERP5Category</string> </value>
...@@ -37,9 +49,7 @@ ...@@ -37,9 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W:158, 2: Arguments number differs from overridden \'login\' method (arguments-differ)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -49,13 +59,28 @@ ...@@ -49,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -68,7 +93,7 @@ ...@@ -68,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -77,7 +102,7 @@ ...@@ -77,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -65,7 +65,7 @@ if 1: # BBB ...@@ -65,7 +65,7 @@ if 1: # BBB
*args, **kw) *args, **kw)
def setGlobalTranslationService(translation_service): def setGlobalTranslationService(translation_service):
global global_translation_service global global_translation_service # pylint:disable=global-statement
global_translation_service = translation_service global_translation_service = translation_service
zope.component.provideUtility(DummyTranslationDomainFallback, zope.component.provideUtility(DummyTranslationDomainFallback,
provides=IFallbackTranslationDomainFactory) provides=IFallbackTranslationDomainFactory)
...@@ -578,9 +578,8 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -578,9 +578,8 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
0 != i.getUid() != i.getProperty('uid')]) 0 != i.getUid() != i.getProperty('uid')])
def test_04_site_manager_and_translation_migration(self): 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.component import queryUtility
from zope.i18n.interfaces import ITranslationDomain
# check translation is working normaly # check translation is working normaly
erp5_ui_catalog = self.portal.Localizer.erp5_ui erp5_ui_catalog = self.portal.Localizer.erp5_ui
self.assertEqual(queryUtility(ITranslationDomain, 'erp5_ui'), self.assertEqual(queryUtility(ITranslationDomain, 'erp5_ui'),
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testERP5Core</string> </value> <value> <string>testERP5Core</string> </value>
...@@ -43,10 +49,7 @@ ...@@ -43,10 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <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>
</value> </value>
</item> </item>
<item> <item>
...@@ -56,13 +59,28 @@ ...@@ -56,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -75,7 +93,7 @@ ...@@ -75,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -84,7 +102,7 @@ ...@@ -84,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -99,8 +99,6 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -99,8 +99,6 @@ class TestERP5Workflow(ERP5TypeTestCase):
transition2.setReference('transition2') transition2.setReference('transition2')
state1.setDestinationValueList([transition1, 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()) self.assertEqual([transition1, transition2], state1.getDestinationValueList())
...@@ -231,6 +229,7 @@ class TestERP5Workflow(ERP5TypeTestCase): ...@@ -231,6 +229,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
""" """
workflow = self.workflow_module.newContent(portal_type='Workflow') workflow = self.workflow_module.newContent(portal_type='Workflow')
state = workflow.newContent(portal_type='Workflow State', title='Some State') state = workflow.newContent(portal_type='Workflow State', title='Some State')
state.Base_viewDict()
transition = workflow.newContent(portal_type='Workflow Transition', transition = workflow.newContent(portal_type='Workflow Transition',
title='Some Transition') title='Some Transition')
transition.setReference('change_something') transition.setReference('change_something')
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testERP5Workflow</string> </value> <value> <string>testERP5Workflow</string> </value>
...@@ -53,13 +59,28 @@ ...@@ -53,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -72,7 +93,7 @@ ...@@ -72,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -81,7 +102,7 @@ ...@@ -81,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -26,13 +26,11 @@ ...@@ -26,13 +26,11 @@
# #
############################################################################## ##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
class TestGeographicalAddress(ERP5TypeTestCase): class TestGeographicalAddress(ERP5TypeTestCase):
""" """
ERP5 Geographical Address related tests. ERP5 Geographical Address related tests.
...@@ -41,7 +39,6 @@ class TestGeographicalAddress(ERP5TypeTestCase): ...@@ -41,7 +39,6 @@ class TestGeographicalAddress(ERP5TypeTestCase):
on a Geographical Address returns the standard text format. on a Geographical Address returns the standard text format.
""" """
run_all_test = 1
entity_portal_type = 'Person' entity_portal_type = 'Person'
address_portal_type = 'Address' address_portal_type = 'Address'
street_address_text = "rue Truc" street_address_text = "rue Truc"
...@@ -49,37 +46,7 @@ class TestGeographicalAddress(ERP5TypeTestCase): ...@@ -49,37 +46,7 @@ class TestGeographicalAddress(ERP5TypeTestCase):
zip_code_text = "12345" zip_code_text = "12345"
city_text = "City1" city_text = "City1"
def getTitle(self): def afterSetUp(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()
self.category_tool = self.getCategoryTool() self.category_tool = self.getCategoryTool()
self.createCategories() self.createCategories()
...@@ -91,7 +58,7 @@ class TestGeographicalAddress(ERP5TypeTestCase): ...@@ -91,7 +58,7 @@ class TestGeographicalAddress(ERP5TypeTestCase):
region_category_list = ['country1', 'country2', ] region_category_list = ['country1', 'country2', ]
if len(self.category_tool.region.contentValues()) == 0 : if len(self.category_tool.region.contentValues()) == 0 :
for category_id in region_category_list: 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, id=category_id,
title=category_id.capitalize()) title=category_id.capitalize())
self.region_category_list = ['region/%s' % x for x \ self.region_category_list = ['region/%s' % x for x \
...@@ -101,7 +68,7 @@ class TestGeographicalAddress(ERP5TypeTestCase): ...@@ -101,7 +68,7 @@ class TestGeographicalAddress(ERP5TypeTestCase):
""" """
Create an entity Create an entity
""" """
portal = self.getPortal() portal = self.portal
module = portal.getDefaultModule(self.entity_portal_type) module = portal.getDefaultModule(self.entity_portal_type)
entity = module.newContent(portal_type=self.entity_portal_type) entity = module.newContent(portal_type=self.entity_portal_type)
sequence.edit( sequence.edit(
...@@ -141,12 +108,10 @@ class TestGeographicalAddress(ERP5TypeTestCase): ...@@ -141,12 +108,10 @@ class TestGeographicalAddress(ERP5TypeTestCase):
self.zip_code_text, self.zip_code_text,
self.city_text,)) self.city_text,))
def test_01_standardAddress(self, quiet=0, run=run_all_test): def test_01_standardAddress(self):
""" """
Test property existence Test property existence
""" """
if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = '\ sequence_string = '\
CreateEntity \ CreateEntity \
...@@ -161,7 +126,7 @@ class TestGeographicalAddress(ERP5TypeTestCase): ...@@ -161,7 +126,7 @@ class TestGeographicalAddress(ERP5TypeTestCase):
""" """
This script returns a different address format. This script returns a different address format.
""" """
createZODBPythonScript(self.getPortal().portal_skins.custom, createZODBPythonScript(self.portal.portal_skins.custom,
'Address_asText', '', """ 'Address_asText', '', """
return '%s\\n%s %s COUNTRY' % \\ return '%s\\n%s %s COUNTRY' % \\
(context.getStreetAddress(), (context.getStreetAddress(),
...@@ -180,12 +145,10 @@ return '%s\\n%s %s COUNTRY' % \\ ...@@ -180,12 +145,10 @@ return '%s\\n%s %s COUNTRY' % \\
self.zip_code_text, self.zip_code_text,
self.city_text)) self.city_text))
def test_02_asTextScript(self, quiet=0, run=run_all_test): def test_02_asTextScript(self):
""" """
Test property existence Test property existence
""" """
if not run: return
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = '\ sequence_string = '\
CreateEntity \ CreateEntity \
...@@ -197,7 +160,3 @@ return '%s\\n%s %s COUNTRY' % \\ ...@@ -197,7 +160,3 @@ return '%s\\n%s %s COUNTRY' % \\
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestGeographicalAddress))
return suite
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testGeographicalAddress</string> </value> <value> <string>testGeographicalAddress</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testGeographicalAddress</string> </value> <value> <string>Products.ERP5.tests.testGeographicalAddress</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testGeographicalAddress</string> </value> <value> <string>test.erp5.testGeographicalAddress</string> </value>
...@@ -37,10 +49,7 @@ ...@@ -37,10 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <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>
</value> </value>
</item> </item>
<item> <item>
...@@ -50,13 +59,28 @@ ...@@ -50,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -69,7 +93,7 @@ ...@@ -69,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -78,7 +102,7 @@ ...@@ -78,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -138,9 +138,9 @@ class TestIdToolUpgrade(ERP5TypeTestCase): ...@@ -138,9 +138,9 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
bt = self.portal.portal_templates.getInstalledBusinessTemplate('erp5_core', bt = self.portal.portal_templates.getInstalledBusinessTemplate('erp5_core',
strict=True) strict=True)
for path, obj in bt._path_item._objects.iteritems(): for path, obj in bt._path_item._objects.iteritems():
path, obj_id = path.rsplit('/', 1) path, obj_id = path.rsplit('/', 1)
if path == 'portal_ids': if path == 'portal_ids':
id_tool._setObject(obj_id, obj._getCopy(bt)) id_tool._setObject(obj_id, obj._getCopy(bt))
self.tic() self.tic()
id_list = id_tool.generateNewLengthIdList(id_group='foo') id_list = id_tool.generateNewLengthIdList(id_group='foo')
# it is known that with current upgrade there is a hole # it is known that with current upgrade there is a hole
...@@ -173,7 +173,7 @@ class TestIdToolUpgrade(ERP5TypeTestCase): ...@@ -173,7 +173,7 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
def _setUpLastMaxIdDict(self, id_generator_reference): def _setUpLastMaxIdDict(self, id_generator_reference):
def countup(id_generator, id_group, until): 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, self.id_tool.generateNewId(id_generator=id_generator_reference,
id_group=id_group) id_group=id_group)
...@@ -251,14 +251,14 @@ class TestIdToolUpgrade(ERP5TypeTestCase): ...@@ -251,14 +251,14 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
self._setUpLastMaxIdDict(id_generator_reference) self._setUpLastMaxIdDict(id_generator_reference)
# test migration: PersistentMapping to OOBTree # test migration: PersistentMapping to OOBTree
self.assertTrue(isinstance(last_id_dict, PersistentMapping)) self.assertIsInstance(last_id_dict, PersistentMapping)
self._assertIdGeneratorLastMaxIdDict(id_generator) self._assertIdGeneratorLastMaxIdDict(id_generator)
id_generator.rebuildGeneratorIdDict() # migrate the dict id_generator.rebuildGeneratorIdDict() # migrate the dict
self._assertIdGeneratorLastMaxIdDict(id_generator) self._assertIdGeneratorLastMaxIdDict(id_generator)
# test migration: OOBTree to OOBTree. this changes nothing, just to be sure # test migration: OOBTree to OOBTree. this changes nothing, just to be sure
last_id_dict = self._getLastIdDict(id_generator) last_id_dict = self._getLastIdDict(id_generator)
self.assertTrue(isinstance(last_id_dict, OOBTree)) self.assertIsInstance(last_id_dict, OOBTree)
self._assertIdGeneratorLastMaxIdDict(id_generator) self._assertIdGeneratorLastMaxIdDict(id_generator)
id_generator.rebuildGeneratorIdDict() # migrate the dict id_generator.rebuildGeneratorIdDict() # migrate the dict
self._assertIdGeneratorLastMaxIdDict(id_generator) self._assertIdGeneratorLastMaxIdDict(id_generator)
...@@ -268,8 +268,8 @@ class TestIdToolUpgrade(ERP5TypeTestCase): ...@@ -268,8 +268,8 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
'SQL Non Continuous Increasing Id Generator': 'SQL Non Continuous Increasing Id Generator':
self._setLastIdDict(id_generator, OOBTree()) # set empty one self._setLastIdDict(id_generator, OOBTree()) # set empty one
last_id_dict = self._getLastIdDict(id_generator) last_id_dict = self._getLastIdDict(id_generator)
assert(len(last_id_dict), 0) # 0 because it is empty self.assertEqual(len(last_id_dict), 0) # 0 because it is empty
self.assertTrue(isinstance(last_id_dict, OOBTree)) self.assertIsInstance(last_id_dict, OOBTree)
# migrate the dict totally from sql table in this case # migrate the dict totally from sql table in this case
id_generator.rebuildGeneratorIdDict() id_generator.rebuildGeneratorIdDict()
self._assertIdGeneratorLastMaxIdDict(id_generator) self._assertIdGeneratorLastMaxIdDict(id_generator)
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testIdToolUpgrade</string> </value> <value> <string>testIdToolUpgrade</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testIdToolUpgrade</string> </value> <value> <string>Products.ERP5.tests.testIdToolUpgrade</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testIdToolUpgrade</string> </value> <value> <string>test.erp5.testIdToolUpgrade</string> </value>
...@@ -37,13 +49,7 @@ ...@@ -37,13 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <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>
</value> </value>
</item> </item>
<item> <item>
...@@ -53,13 +59,28 @@ ...@@ -53,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -72,7 +93,7 @@ ...@@ -72,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -81,7 +102,7 @@ ...@@ -81,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -35,6 +35,7 @@ from Products.ERP5Type.Base import _aq_reset ...@@ -35,6 +35,7 @@ from Products.ERP5Type.Base import _aq_reset
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Workflow import addWorkflowByType from Products.ERP5Type.Workflow import addWorkflowByType
class TestInteractionWorkflow(ERP5TypeTestCase): class TestInteractionWorkflow(ERP5TypeTestCase):
portal_type = 'Organisation' portal_type = 'Organisation'
...@@ -78,11 +79,9 @@ class TestInteractionWorkflow(ERP5TypeTestCase): ...@@ -78,11 +79,9 @@ class TestInteractionWorkflow(ERP5TypeTestCase):
return addWorkflowByType(wf_tool, "interaction_workflow", wf_id) return addWorkflowByType(wf_tool, "interaction_workflow", wf_id)
def createInteractionWorkflow(self): def createInteractionWorkflow(self):
id = 'test_workflow' if getattr(self.getWorkflowTool(), 'test_workflow', None) is None:
wf_type = "interaction_workflow" self._createInteractionWorkflowWithId('test_workflow')
if getattr(self.getWorkflowTool(), id, None) is None: wf = self.getWorkflowTool()['test_workflow']
self._createInteractionWorkflowWithId(id)
wf = self.getWorkflowTool()[id]
self.wf = wf self.wf = wf
if getattr(wf.scripts, 'afterEdit', None) is None: if getattr(wf.scripts, 'afterEdit', None) is None:
wf.scripts.manage_addProduct['PythonScripts']\ wf.scripts.manage_addProduct['PythonScripts']\
...@@ -96,9 +95,7 @@ class TestInteractionWorkflow(ERP5TypeTestCase): ...@@ -96,9 +95,7 @@ class TestInteractionWorkflow(ERP5TypeTestCase):
_aq_reset() # XXX Fails XXX _setLastId not found when doing newContent _aq_reset() # XXX Fails XXX _setLastId not found when doing newContent
def createInteractionWorkflowWithTwoInteractions(self): def createInteractionWorkflowWithTwoInteractions(self):
id = 'test_workflow' wf = self._createInteractionWorkflowWithId('test_workflow')
wf_type = "interaction_workflow (Web-configurable interaction workflow)"
wf = self._createInteractionWorkflowWithId(id)
self.wf = wf self.wf = wf
wf.scripts.manage_addProduct['PythonScripts']\ wf.scripts.manage_addProduct['PythonScripts']\
.manage_addPythonScript(id='afterEditA') .manage_addPythonScript(id='afterEditA')
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testInteractionWorkflow</string> </value> <value> <string>testInteractionWorkflow</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testInteractionWorkflow</string> </value> <value> <string>Products.ERP5.tests.testInteractionWorkflow</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testInteractionWorkflow</string> </value> <value> <string>test.erp5.testInteractionWorkflow</string> </value>
...@@ -37,12 +49,7 @@ ...@@ -37,12 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <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>
</value> </value>
</item> </item>
<item> <item>
...@@ -52,13 +59,28 @@ ...@@ -52,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -71,7 +93,7 @@ ...@@ -71,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -80,7 +102,7 @@ ...@@ -80,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -26,34 +26,14 @@ ...@@ -26,34 +26,14 @@
# #
############################################################################## ##############################################################################
import unittest import json
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
import json
class TestIntrospectionTool(ERP5TypeTestCase): 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): def test_getSystemSignatureJSON(self):
"""
Test
"""
signature_json = self.portal.portal_introspections.getSystemSignatureAsJSON() signature_json = self.portal.portal_introspections.getSystemSignatureAsJSON()
signature_by_json = json.loads(signature_json) signature_by_json = json.loads(signature_json)
signature = self.portal.portal_introspections.getSystemSignatureDict() signature = self.portal.portal_introspections.getSystemSignatureDict()
...@@ -62,7 +42,3 @@ class TestIntrospectionTool(ERP5TypeTestCase): ...@@ -62,7 +42,3 @@ class TestIntrospectionTool(ERP5TypeTestCase):
for key in signature: for key in signature:
self.assertEqual(signature[key], signature_by_json[key]) 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 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testIntrospectionTool</string> </value> <value> <string>testIntrospectionTool</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testIntrospectionTool</string> </value> <value> <string>Products.ERP5.tests.testIntrospectionTool</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testIntrospectionTool</string> </value> <value> <string>test.erp5.testIntrospectionTool</string> </value>
...@@ -37,9 +49,7 @@ ...@@ -37,9 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 46, 2: Arguments number differs from overridden \'login\' method (arguments-differ)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -49,13 +59,28 @@ ...@@ -49,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -68,7 +93,7 @@ ...@@ -68,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -77,7 +102,7 @@ ...@@ -77,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -150,7 +150,7 @@ class TestLocalizer(ERP5TypeTestCase): ...@@ -150,7 +150,7 @@ class TestLocalizer(ERP5TypeTestCase):
{'fr':"C'est 1€.", 'note':'',}) {'fr':"C'est 1€.", 'note':'',})
localizer = portal.Localizer localizer = portal.Localizer
test_script = createZODBPythonScript(portal.portal_skins.custom, createZODBPythonScript(portal.portal_skins.custom,
'test_script', '', """ 'test_script', '', """
def assertEquals(a, b): def assertEquals(a, b):
if a != b: if a != b:
...@@ -191,7 +191,6 @@ assertEquals("This is 1€.", context.Base_translateString("This is 1€.")) ...@@ -191,7 +191,6 @@ assertEquals("This is 1€.", context.Base_translateString("This is 1€."))
value (e.g. the original message) must be returned value (e.g. the original message) must be returned
""" """
message = " This is 1€ non-translated " message = " This is 1€ non-translated "
localizer = self.portal.Localizer
# Base_translateString == Localizer.translate() currently, which calls # Base_translateString == Localizer.translate() currently, which calls
# zope.i18n.translate and sets 'default' to 'message' before passing it to # zope.i18n.translate and sets 'default' to 'message' before passing it to
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testLocalizer</string> </value> <value> <string>testLocalizer</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5Type.tests.testLocalizer</string> </value> <value> <string>Products.ERP5Type.tests.testLocalizer</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testLocalizer</string> </value> <value> <string>test.erp5.testLocalizer</string> </value>
...@@ -37,10 +49,7 @@ ...@@ -37,10 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W:153, 4: Unused variable \'test_script\' (unused-variable)</string>
<string>W:194, 4: Unused variable \'localizer\' (unused-variable)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -50,13 +59,28 @@ ...@@ -50,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -69,7 +93,7 @@ ...@@ -69,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -78,7 +102,7 @@ ...@@ -78,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -74,11 +74,8 @@ class TestMemcachedTool(ERP5TypeTestCase): ...@@ -74,11 +74,8 @@ class TestMemcachedTool(ERP5TypeTestCase):
self.tic() self.tic()
def afterSetUp(self): def afterSetUp(self):
self.login()
def login(self):
uf = self.portal.acl_users uf = self.portal.acl_users
uf._doAddUser('vincent', '', ['Manager'], []) uf._doAddUser('vincent', self.newPassword(), ['Manager'], [])
user = uf.getUserById('vincent').__of__(uf) user = uf.getUserById('vincent').__of__(uf)
newSecurityManager(None, user) newSecurityManager(None, user)
...@@ -104,6 +101,7 @@ class TestMemcachedTool(ERP5TypeTestCase): ...@@ -104,6 +101,7 @@ class TestMemcachedTool(ERP5TypeTestCase):
memcached_tool = self.portal.portal_memcached memcached_tool = self.portal.portal_memcached
try: try:
import memcache import memcache
del memcache
except ImportError: except ImportError:
# MemcachedTool should be disabled # MemcachedTool should be disabled
self.assertRaises(RuntimeError, memcached_tool.getMemcachedDict) self.assertRaises(RuntimeError, memcached_tool.getMemcachedDict)
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testMemcachedTool</string> </value> <value> <string>testMemcachedTool</string> </value>
...@@ -43,10 +49,7 @@ ...@@ -43,10 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <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>
</value> </value>
</item> </item>
<item> <item>
...@@ -56,13 +59,28 @@ ...@@ -56,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -75,7 +93,7 @@ ...@@ -75,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -84,7 +102,7 @@ ...@@ -84,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -39,12 +39,9 @@ class TestNotificationMessageModule(ERP5TypeTestCase): ...@@ -39,12 +39,9 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
return ('erp5_base',) return ('erp5_base',)
def createUser(self, name, role_list):
self.portal.acl_users._doAddUser(name, self.newPassword(), role_list, [])
def afterSetUp(self): def afterSetUp(self):
self.createUser('erp5user', ['Auditor', 'Author']) self.portal.acl_users._doAddUser('erp5user', self.newPassword(), ['Auditor', 'Author'], [])
self.createUser('manager', ['Manager']) self.portal.acl_users._doAddUser('manager', self.newPassword(), ['Manager'], [])
self.portal.email_from_address = 'site@example.invalid' self.portal.email_from_address = 'site@example.invalid'
self.loginByUserName('erp5user') self.loginByUserName('erp5user')
...@@ -130,7 +127,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase): ...@@ -130,7 +127,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
text_content_substitution_mapping_method_id= text_content_substitution_mapping_method_id=
'NotificationMessage_getDummySubstitionMapping') 'NotificationMessage_getDummySubstitionMapping')
mime, text = doc.convert('txt', _, text = doc.convert('txt',
substitution_method_parameter_dict=dict(a='b')) substitution_method_parameter_dict=dict(a='b'))
self.assertEqual('substitution text: b', text.rstrip()) self.assertEqual('substitution text: b', text.rstrip())
...@@ -148,7 +145,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase): ...@@ -148,7 +145,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
text_content_substitution_mapping_method_id= text_content_substitution_mapping_method_id=
'NotificationMessage_getDummySubstitionMapping') 'NotificationMessage_getDummySubstitionMapping')
mime, text = doc.convert('txt') _, text = doc.convert('txt')
self.assertEqual('substitution text: b', text.rstrip()) self.assertEqual('substitution text: b', text.rstrip())
def test_safe_substitution_content(self): def test_safe_substitution_content(self):
...@@ -167,7 +164,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase): ...@@ -167,7 +164,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
text_content_substitution_mapping_method_id= text_content_substitution_mapping_method_id=
'NotificationMessage_getDummySubstitionMapping') 'NotificationMessage_getDummySubstitionMapping')
mime, text = doc.convert('txt') _, text = doc.convert('txt')
self.assertEqual('substitution text: ${b}', text.rstrip()) self.assertEqual('substitution text: ${b}', text.rstrip())
self.assertEqual('${b}', doc.asSubjectText()) self.assertEqual('${b}', doc.asSubjectText())
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testNotificationMessageModule</string> </value> <value> <string>testNotificationMessageModule</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testNotificationMessageModule</string> </value> <value> <string>Products.ERP5.tests.testNotificationMessageModule</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testNotificationMessageModule</string> </value> <value> <string>test.erp5.testNotificationMessageModule</string> </value>
...@@ -37,12 +49,7 @@ ...@@ -37,12 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <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>
</value> </value>
</item> </item>
<item> <item>
...@@ -52,13 +59,28 @@ ...@@ -52,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -71,7 +93,7 @@ ...@@ -71,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -80,7 +102,7 @@ ...@@ -80,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -38,7 +38,7 @@ from email.header import decode_header, make_header ...@@ -38,7 +38,7 @@ from email.header import decode_header, make_header
from email.utils import parseaddr from email.utils import parseaddr
# Copied from ERP5Type/patches/CMFMailIn.py # Copied from ERP5Type/patches/CMFMailIn.py
def decode_email(file): def decode_email(file_):
# Prepare result # Prepare result
theMail = { theMail = {
'attachment_list': [], 'attachment_list': [],
...@@ -47,9 +47,9 @@ def decode_email(file): ...@@ -47,9 +47,9 @@ def decode_email(file):
'headers': {} 'headers': {}
} }
# Get Message # Get Message
msg = email.message_from_string(file) msg = email.message_from_string(file_)
# Back up original file # Back up original file
theMail['__original__'] = file theMail['__original__'] = file_
# Recode headers to UTF-8 if needed # Recode headers to UTF-8 if needed
for key, value in msg.items(): for key, value in msg.items():
decoded_value_list = decode_header(value) decoded_value_list = decode_header(value)
...@@ -61,7 +61,7 @@ def decode_email(file): ...@@ -61,7 +61,7 @@ def decode_email(file):
'to', 'from', 'cc', 'sender', 'reply-to'): 'to', 'from', 'cc', 'sender', 'reply-to'):
header_field = theMail['headers'].get(header) header_field = theMail['headers'].get(header)
if header_field: if header_field:
theMail['headers'][header] = parseaddr(header_field)[1] theMail['headers'][header] = parseaddr(header_field)[1]
# Get attachments # Get attachments
body_found = 0 body_found = 0
for part in msg.walk(): for part in msg.walk():
...@@ -107,7 +107,7 @@ class TestNotificationTool(ERP5TypeTestCase): ...@@ -107,7 +107,7 @@ class TestNotificationTool(ERP5TypeTestCase):
def getTitle(self): def getTitle(self):
return "Notification Tool" 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 = self.getPortal().acl_users
user_folder._doAddUser(name, 'password', role_list, []) user_folder._doAddUser(name, 'password', role_list, [])
...@@ -196,8 +196,8 @@ class TestNotificationTool(ERP5TypeTestCase): ...@@ -196,8 +196,8 @@ class TestNotificationTool(ERP5TypeTestCase):
self.portal.portal_notifications.sendMessage( self.portal.portal_notifications.sendMessage(
recipient=sequence['user_a_id'], subject='Subject', message='Message') recipient=sequence['user_a_id'], subject='Subject', message='Message')
last_message = self.portal.MailHost._last_message last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message) self.assertNotEqual(last_message, ())
mfrom, mto, messageText = last_message mfrom, mto, _ = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userA@example.invalid'], mto) self.assertEqual(['userA@example.invalid'], mto)
...@@ -236,8 +236,8 @@ class TestNotificationTool(ERP5TypeTestCase): ...@@ -236,8 +236,8 @@ class TestNotificationTool(ERP5TypeTestCase):
self.portal.portal_notifications.sendMessage( self.portal.portal_notifications.sendMessage(
subject='Subject', message='Message') subject='Subject', message='Message')
last_message = self.portal.MailHost._last_message last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message) self.assertNotEqual(last_message, ())
mfrom, mto, messageText = last_message mfrom, mto, _ = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['site@example.invalid'], mto) self.assertEqual(['site@example.invalid'], mto)
...@@ -249,8 +249,8 @@ class TestNotificationTool(ERP5TypeTestCase): ...@@ -249,8 +249,8 @@ class TestNotificationTool(ERP5TypeTestCase):
self.portal.portal_notifications.sendMessage( self.portal.portal_notifications.sendMessage(
recipient=sequence['user_a_id'], subject='Subject', ) recipient=sequence['user_a_id'], subject='Subject', )
last_message = self.portal.MailHost._last_message last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message) self.assertNotEqual(last_message, ())
mfrom, mto, messageText = last_message mfrom, mto, _ = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userA@example.invalid'], mto) self.assertEqual(['userA@example.invalid'], mto)
...@@ -272,7 +272,7 @@ class TestNotificationTool(ERP5TypeTestCase): ...@@ -272,7 +272,7 @@ class TestNotificationTool(ERP5TypeTestCase):
self.portal.portal_notifications.sendMessage( self.portal.portal_notifications.sendMessage(
recipient=sequence['user_a_id'], subject='Subject', message='Message') recipient=sequence['user_a_id'], subject='Subject', message='Message')
last_message = self.portal.MailHost._last_message last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message) self.assertNotEqual(last_message, ())
mfrom, mto, messageText = last_message mfrom, mto, messageText = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userA@example.invalid'], mto) self.assertEqual(['userA@example.invalid'], mto)
...@@ -313,7 +313,7 @@ class TestNotificationTool(ERP5TypeTestCase): ...@@ -313,7 +313,7 @@ class TestNotificationTool(ERP5TypeTestCase):
]) ])
last_message = self.portal.MailHost._last_message last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message) self.assertNotEqual(last_message, ())
mfrom, mto, messageText = last_message mfrom, mto, messageText = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userA@example.invalid'], mto) self.assertEqual(['userA@example.invalid'], mto)
...@@ -345,14 +345,14 @@ class TestNotificationTool(ERP5TypeTestCase): ...@@ -345,14 +345,14 @@ class TestNotificationTool(ERP5TypeTestCase):
recipient=[sequence['user_a_id'], sequence['user_b_id']], subject='Subject', message='Message') recipient=[sequence['user_a_id'], sequence['user_b_id']], subject='Subject', message='Message')
last_message = self.portal.MailHost._last_message last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message) self.assertNotEqual(last_message, ())
mfrom, mto, messageText = last_message mfrom, mto, _ = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userB@example.invalid'], mto) self.assertEqual(['userB@example.invalid'], mto)
previous_message = self.portal.MailHost._previous_message previous_message = self.portal.MailHost._previous_message
self.assertNotEquals((), previous_message) self.assertNotEqual(last_message, ())
mfrom, mto, messageText = previous_message mfrom, mto, _ = previous_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userA@example.invalid'], mto) self.assertEqual(['userA@example.invalid'], mto)
...@@ -400,7 +400,7 @@ class TestNotificationTool(ERP5TypeTestCase): ...@@ -400,7 +400,7 @@ class TestNotificationTool(ERP5TypeTestCase):
self.portal.portal_notifications.sendMessage( self.portal.portal_notifications.sendMessage(
recipient=person.getObject(), subject='Subject', message='Message') recipient=person.getObject(), subject='Subject', message='Message')
last_message = self.portal.MailHost._last_message last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message) self.assertNotEqual(last_message, ())
mfrom, mto, messageText = last_message mfrom, mto, messageText = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userA@example.invalid'], mto) self.assertEqual(['userA@example.invalid'], mto)
...@@ -434,7 +434,7 @@ Yes, I will go.""" ...@@ -434,7 +434,7 @@ Yes, I will go."""
recipient=sequence['user_a_id'], subject='Subject', recipient=sequence['user_a_id'], subject='Subject',
message_text_format='text/plain', message=message) message_text_format='text/plain', message=message)
last_message = self.portal.MailHost._last_message last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message) self.assertNotEqual(last_message, ())
mfrom, mto, messageText = last_message mfrom, mto, messageText = last_message
self.assertEqual('Portal Administrator <site@example.invalid>', mfrom) self.assertEqual('Portal Administrator <site@example.invalid>', mfrom)
self.assertEqual(['userA@example.invalid'], mto) self.assertEqual(['userA@example.invalid'], mto)
...@@ -493,7 +493,7 @@ Yes, I will go.""" ...@@ -493,7 +493,7 @@ Yes, I will go."""
self.portal.portal_notifications.sendMessage( self.portal.portal_notifications.sendMessage(
recipient=sequence['user_a_id'], subject='Subject', message='Message') recipient=sequence['user_a_id'], subject='Subject', message='Message')
last_message = self.portal.MailHost._last_message last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message) self.assertNotEqual(last_message, ())
def test_permission_on_recipient_not_needed(self): def test_permission_on_recipient_not_needed(self):
"""Notification Tool can be used to send Messages even when user does not """Notification Tool can be used to send Messages even when user does not
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testNotificationTool</string> </value> <value> <string>testNotificationTool</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testNotificationTool</string> </value> <value> <string>Products.ERP5.tests.testNotificationTool</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testNotificationTool</string> </value> <value> <string>test.erp5.testNotificationTool</string> </value>
...@@ -37,15 +49,7 @@ ...@@ -37,15 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <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>
</value> </value>
</item> </item>
<item> <item>
...@@ -55,13 +59,28 @@ ...@@ -55,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -74,7 +93,7 @@ ...@@ -74,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -83,7 +102,7 @@ ...@@ -83,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
import unittest import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from erp5.component.tool.SessionTool import SESSION_CACHE_FACTORY from erp5.component.tool.SessionTool import SESSION_CACHE_FACTORY
from string import letters as LETTERS from string import letters as LETTERS
...@@ -47,27 +46,6 @@ class TestSessionTool(ERP5TypeTestCase): ...@@ -47,27 +46,6 @@ class TestSessionTool(ERP5TypeTestCase):
session_id = "123456789" 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): def _changeCachePlugin(self, portal_type, storage_duration = 86400):
""" Change current cache plugin with new one. """ """ Change current cache plugin with new one. """
portal_caches = self.portal.portal_caches portal_caches = self.portal.portal_caches
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testSessionTool</string> </value> <value> <string>testSessionTool</string> </value>
...@@ -43,9 +49,7 @@ ...@@ -43,9 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 70, 2: Arguments number differs from overridden \'login\' method (arguments-differ)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -55,13 +59,28 @@ ...@@ -55,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -74,7 +93,7 @@ ...@@ -74,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -83,7 +102,7 @@ ...@@ -83,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -75,4 +75,4 @@ class TestTimeout(ERP5TypeTestCase): ...@@ -75,4 +75,4 @@ class TestTimeout(ERP5TypeTestCase):
with Deadline(1.0): with Deadline(1.0):
time.sleep(2) time.sleep(2)
with self.assertRaises(TimeoutReachedError): 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 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testTimeout</string> </value> <value> <string>testTimeout</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5Type.tests.testTimeout</string> </value> <value> <string>Products.ERP5Type.tests.testTimeout</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testTimeout</string> </value> <value> <string>test.erp5.testTimeout</string> </value>
...@@ -37,9 +49,7 @@ ...@@ -37,9 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <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>
</value> </value>
</item> </item>
<item> <item>
...@@ -49,13 +59,28 @@ ...@@ -49,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <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> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -68,7 +93,7 @@ ...@@ -68,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -77,7 +102,7 @@ ...@@ -77,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
...@@ -26,14 +26,12 @@ ...@@ -26,14 +26,12 @@
# #
############################################################################## ##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager, \ from AccessControl.SecurityManagement import noSecurityManager
noSecurityManager
from AccessControl.ZopeGuards import guarded_apply, guarded_getattr from AccessControl.ZopeGuards import guarded_apply, guarded_getattr
from zExceptions import Unauthorized from zExceptions import Unauthorized
class TestTimerService(ERP5TypeTestCase): class TestTimerService(ERP5TypeTestCase):
""" """
Test TimerService-related features. Maybe this should be put in TimerService Test TimerService-related features. Maybe this should be put in TimerService
...@@ -41,20 +39,6 @@ class TestTimerService(ERP5TypeTestCase): ...@@ -41,20 +39,6 @@ class TestTimerService(ERP5TypeTestCase):
idea to put an ERP5-type test in it. 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): def test_01_checkAnonymousProcessing(self):
""" """
Test whether a timer can be invoked by anonymous. Test whether a timer can be invoked by anonymous.
...@@ -63,14 +47,9 @@ class TestTimerService(ERP5TypeTestCase): ...@@ -63,14 +47,9 @@ class TestTimerService(ERP5TypeTestCase):
timer_service = self.app.Control_Panel.timer_service timer_service = self.app.Control_Panel.timer_service
process_timer = guarded_getattr(timer_service, 'process_timer') process_timer = guarded_getattr(timer_service, 'process_timer')
try: try:
guarded_apply(process_timer, (0,)) guarded_apply(process_timer, (0,))
except Unauthorized: except Unauthorized:
self.fail('calling process_timer is unauthorized') self.fail('calling process_timer is unauthorized')
except: except Exception:
# Do not care about any exception but unauthorized. # Do not care about any exception but unauthorized.
pass pass
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestTimerService))
return suite
...@@ -78,7 +78,7 @@ class TestXMLPickle(unittest.TestCase): ...@@ -78,7 +78,7 @@ class TestXMLPickle(unittest.TestCase):
reconstructed_obj = pickle.loads(reconstructed_pickled_data) reconstructed_obj = pickle.loads(reconstructed_pickled_data)
self.assert_(reconstructed_obj.__class__ is DummyClass) 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.assertEqual(reconstructed_obj.data[0], 1)
self.assert_(reconstructed_obj.data[1] is reconstructed_obj) self.assert_(reconstructed_obj.data[1] is reconstructed_obj)
self.assert_(reconstructed_obj.data[2] is reconstructed_obj.data) self.assert_(reconstructed_obj.data[2] is reconstructed_obj.data)
......
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