Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
8d8066c9
Commit
8d8066c9
authored
May 27, 2021
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core_test: address pylint messages and other small cleanups
parent
a148fcc9
Changes
55
Hide whitespace changes
Inline
Side-by-side
Showing
55 changed files
with
1754 additions
and
2002 deletions
+1754
-2002
bt5/erp5_core_test/MixinTemplateItem/portal_components/mixin.erp5.TestWorkflowMixin.xml
...teItem/portal_components/mixin.erp5.TestWorkflowMixin.xml
+20
-16
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBase.py
.../TestTemplateItem/portal_components/test.erp5.testBase.py
+1
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBase.xml
...TestTemplateItem/portal_components/test.erp5.testBase.xml
+25
-8
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
...eItem/portal_components/test.erp5.testBusinessTemplate.py
+87
-119
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.xml
...Item/portal_components/test.erp5.testBusinessTemplate.xml
+1
-45
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCache.py
...TestTemplateItem/portal_components/test.erp5.testCache.py
+1
-2
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCache.xml
...estTemplateItem/portal_components/test.erp5.testCache.xml
+25
-6
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCacheTool.py
...TemplateItem/portal_components/test.erp5.testCacheTool.py
+1
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCacheTool.xml
...emplateItem/portal_components/test.erp5.testCacheTool.xml
+25
-6
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCachedSkinsTool.py
...teItem/portal_components/test.erp5.testCachedSkinsTool.py
+1
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCachedSkinsTool.xml
...eItem/portal_components/test.erp5.testCachedSkinsTool.xml
+31
-6
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testConstraint.py
...emplateItem/portal_components/test.erp5.testConstraint.py
+46
-53
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testConstraint.xml
...mplateItem/portal_components/test.erp5.testConstraint.xml
+25
-23
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Category.py
...plateItem/portal_components/test.erp5.testERP5Category.py
+1
-8
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Category.xml
...lateItem/portal_components/test.erp5.testERP5Category.xml
+31
-6
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Core.py
...tTemplateItem/portal_components/test.erp5.testERP5Core.py
+2
-3
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Core.xml
...TemplateItem/portal_components/test.erp5.testERP5Core.xml
+25
-7
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Workflow.py
...plateItem/portal_components/test.erp5.testERP5Workflow.py
+1
-2
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Workflow.xml
...lateItem/portal_components/test.erp5.testERP5Workflow.xml
+24
-3
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFolder.py
...estTemplateItem/portal_components/test.erp5.testFolder.py
+229
-229
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFolder.xml
...stTemplateItem/portal_components/test.erp5.testFolder.xml
+31
-193
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFolderMigration.py
...teItem/portal_components/test.erp5.testFolderMigration.py
+472
-472
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFolderMigration.xml
...eItem/portal_components/test.erp5.testFolderMigration.xml
+31
-321
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testGeographicalAddress.py
...em/portal_components/test.erp5.testGeographicalAddress.py
+7
-48
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testGeographicalAddress.xml
...m/portal_components/test.erp5.testGeographicalAddress.xml
+31
-7
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIdToolUpgrade.py
...lateItem/portal_components/test.erp5.testIdToolUpgrade.py
+8
-8
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIdToolUpgrade.xml
...ateItem/portal_components/test.erp5.testIdToolUpgrade.xml
+31
-10
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testInteractionWorkflow.py
...em/portal_components/test.erp5.testInteractionWorkflow.py
+5
-8
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testInteractionWorkflow.xml
...m/portal_components/test.erp5.testInteractionWorkflow.xml
+31
-9
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIntrospectionTool.py
...Item/portal_components/test.erp5.testIntrospectionTool.py
+1
-25
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIntrospectionTool.xml
...tem/portal_components/test.erp5.testIntrospectionTool.xml
+31
-6
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testLocalizer.py
...TemplateItem/portal_components/test.erp5.testLocalizer.py
+1
-2
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testLocalizer.xml
...emplateItem/portal_components/test.erp5.testLocalizer.xml
+31
-7
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testMemcachedTool.py
...lateItem/portal_components/test.erp5.testMemcachedTool.py
+2
-4
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testMemcachedTool.xml
...ateItem/portal_components/test.erp5.testMemcachedTool.xml
+25
-7
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testNotificationMessageModule.py
...tal_components/test.erp5.testNotificationMessageModule.py
+5
-8
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testNotificationMessageModule.xml
...al_components/test.erp5.testNotificationMessageModule.xml
+31
-9
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testNotificationTool.py
...eItem/portal_components/test.erp5.testNotificationTool.py
+20
-20
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testNotificationTool.xml
...Item/portal_components/test.erp5.testNotificationTool.xml
+31
-12
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testSessionTool.py
...mplateItem/portal_components/test.erp5.testSessionTool.py
+0
-22
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testSessionTool.xml
...plateItem/portal_components/test.erp5.testSessionTool.xml
+25
-6
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTimeout.py
...stTemplateItem/portal_components/test.erp5.testTimeout.py
+1
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTimeout.xml
...tTemplateItem/portal_components/test.erp5.testTimeout.xml
+31
-6
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTimerService.py
...plateItem/portal_components/test.erp5.testTimerService.py
+7
-28
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTimerService.xml
...lateItem/portal_components/test.erp5.testTimerService.xml
+31
-9
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTransactionalVariable.py
.../portal_components/test.erp5.testTransactionalVariable.py
+59
-59
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTransactionalVariable.xml
...portal_components/test.erp5.testTransactionalVariable.xml
+31
-53
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTrashTool.py
...TemplateItem/portal_components/test.erp5.testTrashTool.py
+10
-21
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTrashTool.xml
...emplateItem/portal_components/test.erp5.testTrashTool.xml
+31
-13
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWorkflowHistoryList.py
...em/portal_components/test.erp5.testWorkflowHistoryList.py
+16
-17
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWorkflowHistoryList.xml
...m/portal_components/test.erp5.testWorkflowHistoryList.xml
+25
-18
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testXMLPickle.py
...TemplateItem/portal_components/test.erp5.testXMLPickle.py
+1
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testXMLPickle.xml
...emplateItem/portal_components/test.erp5.testXMLPickle.xml
+25
-6
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testZODBHistory.py
...mplateItem/portal_components/test.erp5.testZODBHistory.py
+3
-14
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testZODBHistory.xml
...plateItem/portal_components/test.erp5.testZODBHistory.xml
+31
-7
No files found.
bt5/erp5_core_test/MixinTemplateItem/portal_components/mixin.erp5.TestWorkflowMixin.xml
View file @
8d8066c9
...
...
@@ -100,24 +100,28 @@
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
patches.WorkflowTool
"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.
Workflow
"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key>
<string>
_log
</string>
</key>
<value>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBase.py
View file @
8d8066c9
...
...
@@ -79,7 +79,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
"""
return
(
'erp5_base'
,)
def
login
(
self
):
def
login
(
self
):
# pylint:disable=arguments-differ
uf
=
self
.
getPortal
().
acl_users
uf
.
_doAddUser
(
self
.
username
,
''
,
[
'Manager'
],
[])
user
=
uf
.
getUserById
(
self
.
username
).
__of__
(
uf
)
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBase.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testBase
</string>
</value>
...
...
@@ -43,11 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 82, 2: Arguments number differs from overridden \'login\' method (arguments-differ)
</string>
<string>
W:951, 10: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:1034, 10: Redefining built-in \'id\' (redefined-builtin)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -57,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -76,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -85,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
View file @
8d8066c9
...
...
@@ -42,7 +42,6 @@ from Products.ERP5Type.tests.utils import LogInterceptor
from
Products.ERP5Type.Workflow
import
addWorkflowByType
import
shutil
import
os
import
gc
import
random
import
string
import
tempfile
...
...
@@ -65,7 +64,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
)
## Ignore errors from PortalTransforms (e.g. missing binaries)
def
_catch_log_errors
(
self
):
def
_catch_log_errors
(
self
):
# pylint:disable=arguments-differ
LogInterceptor
.
_catch_log_errors
(
self
)
level
=
self
.
level
def
_tr_init
(
*
args
,
**
kw
):
...
...
@@ -82,7 +81,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
assert
self
.
output
==
'BROKEN'
Transform
.
manage_beforeDelete
=
manage_beforeDelete
def
_ignore_log_errors
(
self
):
def
_ignore_log_errors
(
self
):
# pylint:disable=arguments-differ
Transform
.
_tr_init
=
Transform_tr_init
Transform
.
manage_beforeDelete
=
Transform_manage_beforeDelete
LogInterceptor
.
_ignore_log_errors
(
self
)
...
...
@@ -127,10 +126,6 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
for
d
in
getattr
(
self
,
"rmdir_list"
,
()):
shutil
.
rmtree
(
d
)
pw
=
self
.
getWorkflowTool
()
props
=
{}
for
type_object
in
self
.
getTypesTool
().
listTypeInfo
():
workflow_list
=
type_object
.
getTypeWorkflowList
()
if
'geek_workflow'
in
workflow_list
:
...
...
@@ -421,8 +416,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
trash
=
self
.
getTrashTool
()
trash_ids
=
list
(
trash
.
objectIds
())
for
id
in
trash_ids
:
trash
.
deleteContent
(
id
)
for
id
_
in
trash_ids
:
trash
.
deleteContent
(
id
_
)
self
.
assertFalse
(
len
(
trash
.
objectIds
())
>
0
)
def
stepCheckTrashBin
(
self
,
sequence
=
None
,
**
kw
):
...
...
@@ -600,21 +595,21 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
Create Module with objects
"""
portal
=
self
.
getPortal
()
id
=
'geek_module'
id
_
=
'geek_module'
n
=
0
while
id
in
portal
.
objectIds
():
while
id
_
in
portal
.
objectIds
():
n
=
n
+
1
id
=
"%s_%s"
%
(
'geek_module'
,
n
)
module
=
portal
.
newContent
(
id
=
id
,
portal_type
=
'Geek Module'
)
id
_
=
"%s_%s"
%
(
'geek_module'
,
n
)
module
=
portal
.
newContent
(
id
=
id
_
,
portal_type
=
'Geek Module'
)
self
.
assertTrue
(
module
is
not
None
)
# add a specific permission to module which do not use acquisition
module
.
manage_permission
(
'Copy or Move'
,
[
'Assignor'
],
False
)
sequence
.
edit
(
module_id
=
module
.
getId
())
module_object_list
=
[]
for
i
in
xrange
(
10
):
obj
ect
=
module
.
newContent
(
portal_type
=
'Geek Object'
)
self
.
assert
True
(
object
is
not
None
)
module_object_list
.
append
(
obj
ect
)
for
_
in
xrange
(
10
):
obj
=
module
.
newContent
(
portal_type
=
'Geek Object'
)
self
.
assert
IsNotNone
(
obj
)
module_object_list
.
append
(
obj
)
sequence
.
edit
(
module_object_id_list
=
module_object_list
)
def
stepAddModuleToBusinessTemplate
(
self
,
sequence
=
None
,
**
kw
):
...
...
@@ -623,7 +618,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
bt
=
sequence
.
get
(
'current_bt'
,
None
)
module_id
=
sequence
.
get
(
'module_id'
,
None
)
self
.
assert
True
(
module_id
is
not
None
)
self
.
assert
IsNotNone
(
module_id
)
bt
.
edit
(
template_module_id_list
=
[
module_id
])
def
stepCreateModuleObjects
(
self
,
sequence
=
None
,
**
kw
):
...
...
@@ -633,12 +628,12 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
portal
=
self
.
getPortal
()
module_id
=
sequence
.
get
(
'module_id'
)
module
=
portal
.
_getOb
(
module_id
,
None
)
self
.
assert
True
(
module
is
not
Non
e
)
self
.
assert
IsNotNone
(
modul
e
)
module_object_list
=
[]
for
i
in
xrange
(
10
):
obj
ect
=
module
.
newContent
(
portal_type
=
'Geek Object'
)
self
.
assert
True
(
object
is
not
None
)
module_object_list
.
append
(
obj
ect
.
getId
())
for
_
in
xrange
(
10
):
obj
=
module
.
newContent
(
portal_type
=
'Geek Object'
)
self
.
assert
IsNotNone
(
obj
)
module_object_list
.
append
(
obj
.
getId
())
sequence
.
edit
(
module_object_id_list
=
module_object_list
)
def
stepRemoveModule
(
self
,
sequence
=
None
,
**
kw
):
...
...
@@ -648,7 +643,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
portal
=
self
.
getPortal
()
module_id
=
sequence
.
get
(
"module_id"
)
portal
.
manage_delObjects
([
module_id
])
self
.
assert
False
(
portal
.
_getOb
(
module_id
,
None
)
is
not
None
)
self
.
assert
IsNone
(
portal
.
_getOb
(
module_id
,
None
)
)
def
stepCheckModuleExists
(
self
,
sequence
=
None
,
**
kw
):
"""
...
...
@@ -657,7 +652,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
portal
=
self
.
getPortal
()
module_id
=
sequence
.
get
(
"module_id"
)
new_module
=
portal
.
_getOb
(
module_id
,
None
)
self
.
assert
False
(
new_module
is
Non
e
)
self
.
assert
IsNotNone
(
new_modul
e
)
def
stepCheckModulePermissions
(
self
,
sequence
=
None
,
**
kw
):
"""
...
...
@@ -687,11 +682,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
portal
=
self
.
getPortal
()
module_id
=
sequence
.
get
(
'module_id'
)
module
=
portal
.
_getOb
(
module_id
)
self
.
assert
True
(
module
is
not
Non
e
)
self
.
assert
IsNotNone
(
modul
e
)
object_id_list
=
sequence
.
get
(
'module_object_id_list'
)
for
object_id
in
object_id_list
:
object
=
module
.
_getOb
(
object_id
,
None
)
self
.
assertTrue
(
object
is
not
None
)
self
.
assertIsNotNone
(
module
.
_getOb
(
object_id
,
None
))
def
stepCheckModuleObjectsRemoved
(
self
,
sequence
=
None
,
**
kw
):
"""
...
...
@@ -703,8 +697,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
self
.
assertTrue
(
module
is
not
None
)
object_id_list
=
sequence
.
get
(
'module_object_id_list'
)
for
object_id
in
object_id_list
:
object
=
module
.
_getOb
(
object_id
,
None
)
self
.
assertTrue
(
object
is
None
)
self
.
assertIsNone
(
module
.
_getOb
(
object_id
,
None
))
def
stepCheckModuleRemoved
(
self
,
sequence
=
None
,
**
kw
):
"""
...
...
@@ -712,7 +705,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
portal
=
self
.
getPortal
()
module_id
=
sequence
.
get
(
"module_id"
)
self
.
assert
False
(
portal
.
_getOb
(
module_id
,
None
)
is
not
None
)
self
.
assert
IsNone
(
portal
.
_getOb
(
module_id
,
None
)
)
# skins folder
def
stepCreateSkinFolder
(
self
,
sequence
=
None
,
**
kw
):
...
...
@@ -722,7 +715,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
ps
=
self
.
getSkinsTool
()
ps
.
manage_addProduct
[
'OFSP'
].
manage_addFolder
(
'erp5_geek'
)
skin_folder
=
ps
.
_getOb
(
'erp5_geek'
,
None
)
self
.
assert
True
(
skin_folder
is
not
None
)
self
.
assert
IsNotNone
(
skin_folder
)
sequence
.
edit
(
skin_folder_id
=
skin_folder
.
getId
())
# add skin in layers
for
skin_name
,
selection
in
ps
.
getSkinPaths
():
...
...
@@ -738,7 +731,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
ps
=
self
.
getSkinsTool
()
ps
.
manage_addProduct
[
'OFSP'
].
manage_addFolder
(
'erp5_nerd'
)
skin_folder
=
ps
.
_getOb
(
'erp5_nerd'
,
None
)
self
.
assert
True
(
skin_folder
is
not
None
)
self
.
assert
IsNotNone
(
skin_folder
)
sequence
.
edit
(
another_skin_folder_id
=
skin_folder
.
getId
())
# add skin in layers
for
skin_name
,
selection
in
ps
.
getSkinPaths
():
...
...
@@ -754,7 +747,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
ps
=
self
.
getSkinsTool
()
ps
.
manage_addProduct
[
'OFSP'
].
manage_addFolder
(
'erp5_static'
)
skin_folder
=
ps
.
_getOb
(
'erp5_static'
,
None
)
self
.
assert
True
(
skin_folder
is
not
None
)
self
.
assert
IsNotNone
(
skin_folder
)
sequence
.
edit
(
static_skin_folder_id
=
skin_folder
.
getId
())
# add skin in layers
for
skin_name
,
selection
in
ps
.
getSkinPaths
():
...
...
@@ -767,10 +760,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
def
stepCreateSkinSubFolder
(
self
,
sequence
=
None
,
**
kw
):
ps
=
self
.
getSkinsTool
()
skin_folder
=
ps
.
_getOb
(
'erp5_geek'
,
None
)
self
.
assert
True
(
skin_folder
is
not
None
)
self
.
assert
IsNotNone
(
skin_folder
)
skin_folder
.
manage_addFolder
(
'erp5_subgeek'
)
skin_subfolder
=
skin_folder
.
_getOb
(
'erp5_subgeek'
,
None
)
self
.
assert
True
(
skin_subfolder
is
not
None
)
self
.
assert
IsNotNone
(
skin_subfolder
)
sequence
.
edit
(
skin_subfolder_id
=
skin_subfolder
.
getId
())
def
stepCheckSkinSubFolderExists
(
self
,
sequence
=
None
,
**
kw
):
...
...
@@ -780,21 +773,21 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
ps
=
self
.
getSkinsTool
()
skin_id
=
sequence
.
get
(
'skin_folder_id'
)
skin_folder
=
ps
.
_getOb
(
skin_id
,
None
)
self
.
assert
True
(
skin_folder
is
not
None
)
self
.
assert
IsNotNone
(
skin_folder
)
subskin_id
=
sequence
.
get
(
'skin_subfolder_id'
)
skin_subfolder
=
skin_folder
.
_getOb
(
subskin_id
,
None
)
self
.
assert
True
(
skin_subfolder
is
not
None
)
self
.
assert
IsNotNone
(
skin_subfolder
)
def
stepCreateNewForm
(
self
,
sequence
=
None
):
"""Create a new ERP5 Form in a skin folder."""
ps
=
self
.
getSkinsTool
()
skin_folder
=
ps
.
_getOb
(
'erp5_geek'
,
None
)
self
.
assert
NotEquals
(
skin_folder
,
None
)
self
.
assert
IsNotNone
(
skin_folder
)
form_id
=
'Geek_view'
addERP5Form
=
skin_folder
.
manage_addProduct
[
'ERP5Form'
].
addERP5Form
addERP5Form
(
form_id
,
'View'
)
form
=
skin_folder
.
_getOb
(
form_id
,
None
)
self
.
assert
NotEquals
(
form
,
None
)
self
.
assert
IsNotNone
(
form
)
self
.
assertEqual
(
sorted
(
form
.
get_groups
(
include_empty
=
1
)),
sorted
([
'left'
,
'right'
,
'center'
,
'bottom'
,
'hidden'
]))
addField
=
form
.
manage_addProduct
[
'Formulator'
].
manage_addField
...
...
@@ -813,12 +806,12 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""Create a new ERP5 Form in a skin folder."""
ps
=
self
.
getSkinsTool
()
skin_folder
=
ps
.
_getOb
(
'erp5_nerd'
,
None
)
self
.
assert
NotEquals
(
skin_folder
,
None
)
self
.
assert
IsNotNone
(
skin_folder
)
form_id
=
'Geek_view'
addERP5Form
=
skin_folder
.
manage_addProduct
[
'ERP5Form'
].
addERP5Form
addERP5Form
(
form_id
,
'View'
)
form
=
skin_folder
.
_getOb
(
form_id
,
None
)
self
.
assert
NotEquals
(
form
,
None
)
self
.
assert
IsNotNone
(
form
)
self
.
assertEqual
(
sorted
(
form
.
get_groups
(
include_empty
=
1
)),
sorted
([
'left'
,
'right'
,
'center'
,
'bottom'
,
'hidden'
]))
addField
=
form
.
manage_addProduct
[
'Formulator'
].
manage_addField
...
...
@@ -837,22 +830,22 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""Remove an ERP5 Form."""
ps
=
self
.
getSkinsTool
()
skin_folder
=
ps
.
_getOb
(
'erp5_geek'
,
None
)
self
.
assert
NotEquals
(
skin_folder
,
None
)
self
.
assert
IsNotNone
(
skin_folder
)
form_id
=
sequence
.
get
(
'form_id'
)
form
=
skin_folder
.
_getOb
(
form_id
,
None
)
self
.
assert
NotEquals
(
form
,
None
)
self
.
assert
IsNotNone
(
form
)
skin_folder
.
manage_delObjects
([
form_id
])
form
=
skin_folder
.
_getOb
(
form_id
,
None
)
self
.
assert
Equal
(
form
,
None
)
self
.
assert
IsNone
(
form
)
def
stepAddFormField
(
self
,
sequence
=
None
):
"""Add a field to an ERP5 Form."""
ps
=
self
.
getSkinsTool
()
skin_folder
=
ps
.
_getOb
(
'erp5_geek'
,
None
)
self
.
assert
NotEquals
(
skin_folder
,
None
)
self
.
assert
IsNotNone
(
skin_folder
)
form_id
=
sequence
.
get
(
'form_id'
)
form
=
skin_folder
.
_getOb
(
form_id
,
None
)
self
.
assert
NotEquals
(
form
,
None
)
self
.
assert
IsNotNone
(
form
)
self
.
assertEqual
(
sorted
(
form
.
get_groups
(
include_empty
=
1
)),
sorted
([
'left'
,
'right'
,
'center'
,
'bottom'
,
'hidden'
]))
addField
=
form
.
manage_addProduct
[
'Formulator'
].
manage_addField
...
...
@@ -871,12 +864,12 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
def
stepModifyFormTitle
(
self
,
sequence
=
None
):
ps
=
self
.
getSkinsTool
()
skin_folder
=
ps
.
_getOb
(
'erp5_geek'
,
None
)
self
.
assert
NotEquals
(
skin_folder
,
None
)
self
.
assert
IsNotNone
(
skin_folder
)
form_id
=
sequence
.
get
(
'form_id'
)
form
=
skin_folder
.
_getOb
(
form_id
,
None
)
form_title
=
'First Form Title'
form
.
title
=
form_title
self
.
assert
NotEquals
(
form
,
None
)
self
.
assert
IsNotNone
(
form
)
self
.
assertEqual
(
sorted
(
form
.
get_groups
(
include_empty
=
1
)),
sorted
([
'left'
,
'right'
,
'center'
,
'bottom'
,
'hidden'
]))
group_dict
=
{}
...
...
@@ -891,7 +884,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
def
stepRevertFormTitle
(
self
,
sequence
=
None
):
ps
=
self
.
getSkinsTool
()
skin_folder
=
ps
.
_getOb
(
'erp5_geek'
,
None
)
self
.
assert
NotEquals
(
skin_folder
,
None
)
self
.
assert
IsNotNone
(
skin_folder
)
form_id
=
sequence
.
get
(
'form_id'
)
form
=
skin_folder
.
_getOb
(
form_id
,
None
)
form_title
=
'Second Form Title'
...
...
@@ -900,7 +893,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
def
stepCheckFormTitle
(
self
,
sequence
=
None
):
ps
=
self
.
getSkinsTool
()
skin_folder
=
ps
.
_getOb
(
'erp5_geek'
,
None
)
self
.
assert
NotEquals
(
skin_folder
,
None
)
self
.
assert
IsNotNone
(
skin_folder
)
form_id
=
sequence
.
get
(
'form_id'
)
form
=
skin_folder
.
_getOb
(
form_id
,
None
)
self
.
assertEqual
(
'First Form Title'
,
form
.
title
)
...
...
@@ -909,7 +902,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""Check the form is exist in erp5_geek."""
ps
=
self
.
getSkinsTool
()
skin_folder
=
ps
.
_getOb
(
'erp5_geek'
,
None
)
self
.
assert
NotEquals
(
skin_folder
,
None
)
self
.
assert
IsNotNone
(
skin_folder
)
form_id
=
sequence
.
get
(
'form_id'
)
form
=
skin_folder
.
_getOb
(
form_id
,
None
)
self
.
assertEqual
(
form
,
None
)
...
...
@@ -918,19 +911,19 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""Check the form is not exist in erp5_nerd."""
ps
=
self
.
getSkinsTool
()
skin_folder
=
ps
.
_getOb
(
'erp5_nerd'
,
None
)
self
.
assert
NotEquals
(
skin_folder
,
None
)
self
.
assert
IsNotNone
(
skin_folder
)
form_id
=
sequence
.
get
(
'form_id'
)
form
=
skin_folder
.
_getOb
(
form_id
,
None
)
self
.
assert
NotEquals
(
form
,
None
)
self
.
assert
IsNotNone
(
form
)
def
stepRemoveFormField
(
self
,
sequence
=
None
):
"""Remove a field from an ERP5 Form."""
ps
=
self
.
getSkinsTool
()
skin_folder
=
ps
.
_getOb
(
'erp5_geek'
,
None
)
self
.
assert
NotEquals
(
skin_folder
,
None
)
self
.
assert
IsNotNone
(
skin_folder
)
form_id
=
sequence
.
get
(
'form_id'
)
form
=
skin_folder
.
_getOb
(
form_id
,
None
)
self
.
assert
NotEquals
(
form
,
None
)
self
.
assert
IsNotNone
(
form
)
field_id
=
sequence
.
get
(
'field_id'
)
field
=
form
.
get_field
(
field_id
)
self
.
assertNotEquals
(
field
,
None
)
...
...
@@ -941,10 +934,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""Check the groups of an ERP5 Form."""
ps
=
self
.
getSkinsTool
()
skin_folder
=
ps
.
_getOb
(
'erp5_geek'
,
None
)
self
.
assert
NotEquals
(
skin_folder
,
None
)
self
.
assert
IsNotNone
(
skin_folder
)
form_id
=
sequence
.
get
(
'form_id'
)
form
=
skin_folder
.
_getOb
(
form_id
,
None
)
self
.
assert
NotEquals
(
form
,
None
)
self
.
assert
IsNotNone
(
form
)
group_dict
=
sequence
.
get
(
'group_dict'
)
self
.
assertEqual
(
sorted
(
form
.
get_groups
(
include_empty
=
1
)),
sorted
(
group_dict
.
iterkeys
()))
...
...
@@ -958,10 +951,10 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""Check that field title is not removed form erp5_nerd."""
ps
=
self
.
getSkinsTool
()
skin_folder
=
ps
.
_getOb
(
'erp5_nerd'
,
None
)
self
.
assert
NotEquals
(
skin_folder
,
None
)
self
.
assert
IsNotNone
(
skin_folder
)
form_id
=
sequence
.
get
(
'form_id'
)
form
=
skin_folder
.
_getOb
(
form_id
,
None
)
self
.
assert
NotEquals
(
form
,
None
)
self
.
assert
IsNotNone
(
form
)
title_field
=
form
.
_getOb
(
'my_title'
,
None
)
self
.
assertNotEquals
(
title_field
,
None
)
...
...
@@ -1185,9 +1178,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
base_category
=
pc
.
_getOb
(
bc_id
,
None
)
self
.
assertTrue
(
base_category
is
not
None
)
category_list
=
[]
for
i
in
xrange
(
10
):
for
_
in
xrange
(
10
):
category
=
base_category
.
newContent
(
portal_type
=
'Category'
)
self
.
assertTrue
(
category
is
not
None
)
category_list
.
append
(
category
.
getId
())
sequence
.
edit
(
category_id_list
=
category_list
)
...
...
@@ -1253,9 +1245,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
self
.
assertTrue
(
category
is
not
None
)
subcategory_list
=
[]
subcategory_uid_dict
=
{}
for
i
in
xrange
(
10
):
for
_
in
xrange
(
10
):
subcategory
=
category
.
newContent
(
portal_type
=
'Category'
,
title
=
'toto'
)
self
.
assertTrue
(
subcategory
is
not
None
)
subcategory_list
.
append
(
subcategory
.
getId
())
subcategory_uid_dict
[
subcategory
.
getId
()]
=
subcategory
.
getUid
()
sequence
.
edit
(
subcategory_id_list
=
subcategory_list
,
\
...
...
@@ -1430,8 +1421,8 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
wf_id
=
sequence
.
get
(
'workflow_id'
)
tt
=
self
.
getPortal
()[
'portal_trash'
]
self
.
assertEqual
(
len
(
tt
.
objectIds
()),
1
)
bin
=
tt
.
objectValues
()[
0
]
self
.
assertNotEqual
(
len
(
bin
.
portal_workflow_items
[
wf_id
].
objectIds
()),
0
)
trash_
bin
=
tt
.
objectValues
()[
0
]
self
.
assertNotEqual
(
len
(
trash_
bin
.
portal_workflow_items
[
wf_id
].
objectIds
()),
0
)
# Actions
def
stepCreateFirstAction
(
self
,
sequence
=
None
,
**
kw
):
...
...
@@ -1666,11 +1657,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
self
.
assertIn
(
method_id
,
catalog
.
sql_uncatalog_object
)
# check filter
filter_dict
=
catalog
.
_getFilterDict
()
filter
=
filter_dict
[
method_id
]
self
.
assertItemsEqual
(
filter
[
'expression_cache_key'
],
[
'portal_type'
])
self
.
assertEqual
(
filter
[
'type'
],
[])
self
.
assertEqual
(
filter
[
'filtered'
],
1
)
self
.
assertEqual
(
filter
[
'expression'
],
'python: context.isPredicate()'
)
filter
_
=
filter_dict
[
method_id
]
self
.
assertItemsEqual
(
filter
_
[
'expression_cache_key'
],
[
'portal_type'
])
self
.
assertEqual
(
filter
_
[
'type'
],
[])
self
.
assertEqual
(
filter
_
[
'filtered'
],
1
)
self
.
assertEqual
(
filter
_
[
'expression'
],
'python: context.isPredicate()'
)
def
stepCheckUpdatedCatalogMethodExists
(
self
,
sequence
=
None
,
**
kw
):
pc
=
self
.
getCatalogTool
()
...
...
@@ -1683,11 +1674,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
self
.
assertIn
(
method_id
,
catalog
.
sql_uncatalog_object
)
# check filter
filter_dict
=
catalog
.
_getFilterDict
()
filter
=
filter_dict
[
method_id
]
self
.
assertItemsEqual
(
filter
[
'expression_cache_key'
],
[
'portal_type'
])
self
.
assertEqual
(
filter
[
'type'
],
[])
self
.
assertEqual
(
filter
[
'filtered'
],
1
)
self
.
assertEqual
(
filter
[
'expression'
],
'python: context.isDelivery()'
)
filter
_
=
filter_dict
[
method_id
]
self
.
assertItemsEqual
(
filter
_
[
'expression_cache_key'
],
[
'portal_type'
])
self
.
assertEqual
(
filter
_
[
'type'
],
[])
self
.
assertEqual
(
filter
_
[
'filtered'
],
1
)
self
.
assertEqual
(
filter
_
[
'expression'
],
'python: context.isDelivery()'
)
def
stepCheckCatalogMethodRemoved
(
self
,
sequence
=
None
,
**
kw
):
"""
...
...
@@ -1703,7 +1694,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
self
.
assertNotIn
(
method_id
,
catalog
.
sql_uncatalog_object
)
# check filter
with
self
.
assertRaises
(
KeyError
):
catalog
.
_getFilterDict
()[
method_id
]
_
=
catalog
.
_getFilterDict
()[
method_id
]
def
stepRemoveCatalogMethod
(
self
,
sequence
=
None
,
**
kw
):
"""
...
...
@@ -1724,7 +1715,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
self
.
assertNotIn
(
method_id
,
catalog
.
sql_uncatalog_object
)
# remove filter
with
self
.
assertRaises
(
KeyError
):
catalog
.
_getFilterDict
()[
method_id
]
_
=
catalog
.
_getFilterDict
()[
method_id
]
# Related key, Result key and table, and others
def
stepCreateKeysAndTable
(
self
,
sequence
=
list
,
**
kw
):
...
...
@@ -2391,9 +2382,9 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
Add Property Sheet to Business Template
"""
bt
=
sequence
.
get
(
'current_bt'
,
None
)
self
.
assert
True
(
bt
is
not
None
)
self
.
assert
IsNotNone
(
bt
)
ps_title
=
sequence
.
get
(
'ps_title'
,
None
)
self
.
assert
True
(
ps_title
is
not
Non
e
)
self
.
assert
IsNotNone
(
ps_titl
e
)
bt
.
edit
(
template_property_sheet_id_list
=
[
ps_title
])
def
stepCheckPropertySheetMigration
(
self
,
sequence
=
None
,
**
kw
):
...
...
@@ -2413,19 +2404,11 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
Remove Property Sheet
"""
ps_title
=
sequence
.
get
(
'ps_title'
,
None
)
ps_path
=
sequence
.
get
(
'ps_path'
,
None
)
self
.
assert
True
(
ps_path
is
not
None
)
self
.
assert
IsNotNone
(
ps_path
)
self
.
assertTrue
(
os
.
path
.
exists
(
ps_path
))
os
.
remove
(
ps_path
)
self
.
assertFalse
(
os
.
path
.
exists
(
ps_path
))
return
# Property Sheet will not be installed in file sytem
self
.
assertFalse
(
os
.
path
.
exists
(
ps_path
))
# Property Sheet will be installed in ZODB
self
.
assertTrue
(
getattr
(
self
.
portal
.
portal_property_sheets
,
ps_title
,
None
)
is
not
None
)
self
.
portal
.
portal_property_sheets
.
manage_delObjects
([
ps_title
])
self
.
assertFalse
(
getattr
(
self
.
portal
.
portal_property_sheets
,
ps_title
,
None
)
is
not
None
)
def
stepRemovePropertySheetFromZODB
(
self
,
sequence
=
None
,
sequencer_list
=
None
,
**
kw
):
"""
...
...
@@ -2433,7 +2416,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
ps_title
=
sequence
.
get
(
'ps_title'
,
None
)
ps_path
=
sequence
.
get
(
'ps_path'
,
None
)
self
.
assert
True
(
ps_path
is
not
None
)
self
.
assert
IsNotNone
(
ps_path
)
# Property Sheet will not be installed in file sytem
self
.
assertFalse
(
os
.
path
.
exists
(
ps_path
))
# Property Sheet will be installed in ZODB
...
...
@@ -2447,7 +2430,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
ps_title
=
sequence
.
get
(
'ps_title'
,
None
)
ps_path
=
sequence
.
get
(
'ps_path'
,
None
)
self
.
assert
True
(
ps_path
is
not
None
)
self
.
assert
IsNotNone
(
ps_path
)
# Property Sheet will not be installed in file sytem
self
.
assertFalse
(
os
.
path
.
exists
(
ps_path
))
# Property Sheet will be installed in ZODB
...
...
@@ -2458,7 +2441,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
Check deletion of Property Sheet
"""
ps_path
=
sequence
.
get
(
'ps_path'
,
None
)
self
.
assert
True
(
ps_path
is
not
None
)
self
.
assert
IsNotNone
(
ps_path
)
self
.
assertFalse
(
os
.
path
.
exists
(
ps_path
))
def
stepCheckMigratedPropertySheetRemoved
(
self
,
sequence
=
None
,
**
kw
):
...
...
@@ -2492,7 +2475,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
ps_title
=
sequence
.
get
(
'ps_title'
,
None
)
ps_path
=
sequence
.
get
(
'ps_path'
,
None
)
self
.
assert
True
(
ps_path
is
not
None
)
self
.
assert
IsNotNone
(
ps_path
)
# Property Sheet will not be installed in file sytem
self
.
assertFalse
(
os
.
path
.
exists
(
ps_path
))
# Property Sheet will be installed in ZODB
...
...
@@ -2696,7 +2679,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
for
item_name
in
item_list
:
item
=
getattr
(
bt
,
item_name
)
if
item
is
not
None
:
for
key
,
data
in
item
.
_objects
.
item
s
():
for
data
in
item
.
_objects
.
itervalue
s
():
if
hasattr
(
data
,
'__ac_local_roles__'
):
self
.
assertTrue
(
data
.
__ac_local_roles__
is
None
)
if
hasattr
(
data
,
'_owner'
):
...
...
@@ -2796,7 +2779,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
self
.
assertTrue
(
p
.
_getOb
(
'portal_simulation'
,
None
)
is
None
)
def
stepCheckSimulationToolExists
(
self
,
sequence
=
None
,
**
kw
):
self
.
assert
True
(
self
.
getSimulationTool
()
is
not
None
)
self
.
assert
IsNotNone
(
self
.
getSimulationTool
()
)
def
stepCheckSubobjectsNotIncluded
(
self
,
sequence
=
None
,
**
kw
):
"""Check subobjects are not included in the base category.
...
...
@@ -2806,30 +2789,19 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
# XXX maybe too low level
base_category_obj
=
bt
.
_category_item
.
_objects
.
get
(
'portal_categories/%s'
%
base_category_id
)
self
.
assert
True
(
base_category_obj
is
not
None
)
self
.
assert
IsNotNone
(
base_category_obj
)
self
.
assertEqual
(
len
(
base_category_obj
.
objectIds
()),
0
)
def
stepCheckNoMissingDependencies
(
self
,
sequence
=
None
,
**
kw
):
""" Check if bt has no missing dependency
"""
missing_dep
=
False
bt
=
sequence
.
get
(
'current_bt'
)
try
:
bt
.
checkDependencies
()
except
:
missing_dep
=
True
self
.
assertTrue
(
not
missing_dep
)
sequence
[
'current_bt'
].
checkDependencies
()
def
stepCheckMissingDependencies
(
self
,
sequence
=
None
,
**
kw
):
""" Check if bt has missing dependency
"""
missing_dep
=
False
bt
=
sequence
.
get
(
'current_bt'
)
try
:
bt
.
checkDependencies
()
except
:
missing_dep
=
True
self
.
assertTrue
(
missing_dep
)
with
self
.
assertRaises
(
Exception
):
sequence
[
'current_bt'
].
checkDependencies
()
def
stepAddDependency
(
self
,
sequence
=
None
,
**
kw
):
""" Add a dependency to the business template
...
...
@@ -2992,7 +2964,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
new_value
=
[]
workflow_chain_list
=
list
(
bt
.
getTemplatePortalTypeWorkflowChainList
())
for
workflow_chain
in
workflow_chain_list
:
portal_type
,
wkflow_id
=
workflow_chain
.
split
(
' | '
)
_
,
wkflow_id
=
workflow_chain
.
split
(
' | '
)
if
wkflow_id
!=
workflow_id
:
new_value
.
append
(
workflow_chain
)
bt
.
edit
(
template_portal_type_workflow_chain_list
=
new_value
)
...
...
@@ -3018,8 +2990,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
"""
Add type role to business template
"""
bt
=
sequence
.
get
(
'current_bt'
,
None
)
self
.
assertTrue
(
bt
is
not
None
)
bt
=
sequence
[
'current_bt'
]
ptype_ids
=
[]
ptype_ids
.
append
(
sequence
.
get
(
'object_ptype_id'
,
''
))
ptype_ids
.
append
(
sequence
.
get
(
'module_ptype_id'
,
''
))
...
...
@@ -3069,7 +3040,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
def
stepCreateFakeZODBScript
(
self
,
sequence
=
None
,
**
kw
):
"""Create a Script inside portal_skins
"""
grain_of_sand
=
''
.
join
([
random
.
choice
(
string
.
ascii_letters
)
for
i
in
xrange
(
10
)])
grain_of_sand
=
''
.
join
([
random
.
choice
(
string
.
ascii_letters
)
for
_
in
xrange
(
10
)])
python_script_id
=
'ERP5Site_dummyScriptWhichRandomId%s'
%
grain_of_sand
skin_folder_id
=
'custom'
if
getattr
(
self
.
portal
.
portal_skins
,
skin_folder_id
,
None
)
is
None
:
...
...
@@ -6765,7 +6736,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
"""
# Simulate the case where we have an installed business template providing
# the path test_document
new_object
=
self
.
portal
.
newContent
(
portal_type
=
'File'
,
id
=
'test_document'
)
self
.
portal
.
newContent
(
portal_type
=
'File'
,
id
=
'test_document'
)
bt
=
self
.
portal
.
portal_templates
.
newContent
(
portal_type
=
'Business Template'
,
...
...
@@ -7150,12 +7121,10 @@ class TestBusinessTemplate(BusinessTemplateMixin):
bt
.
edit
(
template_registered_version_priority_selection_list
=
())
def
stepCheckVersionPrioritySetOnSite
(
self
,
sequence
=
None
,
**
kw
):
bt
=
sequence
.
get
(
'current_bt'
)
self
.
assertEqual
(
self
.
getPortalObject
().
getVersionPriorityList
(),
sequence
[
'expected_version_priority_list'
])
def
stepCheckVersionPriorityRemovedFromSite
(
self
,
sequence
=
None
,
**
kw
):
bt
=
sequence
.
get
(
'current_bt'
)
self
.
assertEqual
(
self
.
getPortalObject
().
getVersionPriorityList
(),
(
'erp5 | 0.0'
,))
...
...
@@ -7341,8 +7310,7 @@ class TestBusinessTemplate(BusinessTemplateMixin):
self
.
commit
()
self
.
portal
.
organisation_module
.
manage_delObjects
([
'1'
])
broken
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Mock Broken Organisation'
,
id
=
'1'
)
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Mock Broken Organisation'
,
id
=
'1'
)
self
.
commit
()
self
.
tic
()
# triger undex/index the document
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.xml
View file @
8d8066c9
...
...
@@ -49,51 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 68, 2: Arguments number differs from overridden \'_catch_log_errors\' method (arguments-differ)
</string>
<string>
W: 85, 2: Arguments number differs from overridden \'_ignore_log_errors\' method (arguments-differ)
</string>
<string>
W:135, 10: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:427, 8: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:618, 6: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:606, 4: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:617, 8: Unused variable \'i\' (unused-variable)
</string>
<string>
W:642, 6: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:641, 8: Unused variable \'i\' (unused-variable)
</string>
<string>
W:696, 6: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:709, 6: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:1191, 8: Unused variable \'i\' (unused-variable)
</string>
<string>
W:1259, 8: Unused variable \'i\' (unused-variable)
</string>
<string>
W:1337, 10: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:1353, 10: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:1366, 10: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:1377, 10: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:1389, 10: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:1389, 14: Unused variable \'wf_ids\' (unused-variable)
</string>
<string>
W:1445, 10: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:1477, 4: Redefining built-in \'bin\' (redefined-builtin)
</string>
<string>
W:1713, 4: Redefining built-in \'filter\' (redefined-builtin)
</string>
<string>
W:1730, 4: Redefining built-in \'filter\' (redefined-builtin)
</string>
<string>
W:1750, 6: Expression "catalog._getFilterDict()[method_id]" is assigned to nothing (expression-not-assigned)
</string>
<string>
W:1771, 6: Expression "catalog._getFilterDict()[method_id]" is assigned to nothing (expression-not-assigned)
</string>
<string>
W:2468, 4: Unreachable code (unreachable)
</string>
<string>
W:2743, 12: Unused variable \'key\' (unused-variable)
</string>
<string>
W:2863, 4: No exception type(s) specified (bare-except)
</string>
<string>
W:2874, 4: No exception type(s) specified (bare-except)
</string>
<string>
W:2968, 10: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:2998, 10: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:2998, 14: Unused variable \'wf_ids\' (unused-variable)
</string>
<string>
W:3013, 10: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:3013, 14: Unused variable \'wf_ids\' (unused-variable)
</string>
<string>
W:3028, 10: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:3066, 6: Unused variable \'portal_type\' (unused-variable)
</string>
<string>
W:3143, 69: Unused variable \'i\' (unused-variable)
</string>
<string>
W:6460, 8: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:6855, 4: Unused variable \'new_object\' (unused-variable)
</string>
<string>
W:7169, 4: Unused variable \'bt\' (unused-variable)
</string>
<string>
W:7174, 4: Unused variable \'bt\' (unused-variable)
</string>
<string>
W:7360, 4: Unused variable \'broken\' (unused-variable)
</string>
<string>
W: 45, 0: Unused import gc (unused-import)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCache.py
View file @
8d8066c9
...
...
@@ -65,8 +65,7 @@ class TestRamCache(ERP5TypeTestCase):
test_scopes
.
sort
()
## remove DistributedRamCache since it's a flat storage
filtered_cache_plugins
=
filter
(
lambda
x
:
not
isinstance
(
x
,
DistributedRamCache
),
self
.
cache_plugins
)
filtered_cache_plugins
=
[
x
for
x
in
self
.
cache_plugins
if
not
isinstance
(
x
,
DistributedRamCache
)]
for
cache_plugin
in
filtered_cache_plugins
:
if
not
self
.
quiet
:
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCache.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testCache
</string>
</value>
...
...
@@ -43,9 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 68, 29: map/filter on lambda could be replaced by comprehension (deprecated-lambda)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -55,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -74,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -83,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCacheTool.py
View file @
8d8066c9
...
...
@@ -65,7 +65,7 @@ class TestCacheTool(ERP5TypeTestCase):
self
.
createCachedMethod
()
self
.
commit
()
def
login
(
self
):
def
login
(
self
):
# pylint:disable=arguments-differ
uf
=
self
.
portal
.
acl_users
uf
.
_doAddUser
(
'admin'
,
''
,
[
'Manager'
],
[])
uf
.
_doAddUser
(
'ERP5TypeTestCase'
,
''
,
[
'Manager'
],
[])
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCacheTool.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testCacheTool
</string>
</value>
...
...
@@ -43,9 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 68, 2: Arguments number differs from overridden \'login\' method (arguments-differ)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -55,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -74,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -83,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCachedSkinsTool.py
View file @
8d8066c9
...
...
@@ -57,7 +57,7 @@ class TestCachedSkinsTool(ERP5TypeTestCase):
# Use None as skinname to keep using the default one.
self
.
getSkinnableObject
().
changeSkin
(
skinname
=
None
)
def
login
(
self
):
def
login
(
self
):
# pylint:disable=arguments-differ
uf
=
self
.
portal
.
acl_users
uf
.
_doAddUser
(
'vincent'
,
''
,
[
'Manager'
],
[])
user
=
uf
.
getUserById
(
'vincent'
).
__of__
(
uf
)
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCachedSkinsTool.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testCachedSkinsTool
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5Type.tests.testCachedSkinsTool
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testCachedSkinsTool
</string>
</value>
...
...
@@ -37,9 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 60, 2: Arguments number differs from overridden \'login\' method (arguments-differ)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -49,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -68,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -77,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testConstraint.py
View file @
8d8066c9
...
...
@@ -49,7 +49,7 @@ class TestConstraint(PropertySheetTestCase):
"""
return
(
'erp5_base'
,)
def
login
(
self
):
def
login
(
self
):
# pylint:disable=arguments-differ
uf
=
self
.
portal
.
acl_users
uf
.
_doAddUser
(
'rc'
,
''
,
[
'Manager'
],
[])
user
=
uf
.
getUserById
(
'rc'
).
__of__
(
uf
)
...
...
@@ -114,26 +114,24 @@ class TestConstraint(PropertySheetTestCase):
Create a object which will be tested.
"""
module
=
self
.
portal
.
getDefaultModule
(
self
.
object_portal_type
)
objec
t
=
module
.
newContent
(
portal_type
=
self
.
object_portal_type
)
group1
=
objec
t
.
portal_categories
.
restrictedTraverse
(
'group/testGroup1'
)
documen
t
=
module
.
newContent
(
portal_type
=
self
.
object_portal_type
)
group1
=
documen
t
.
portal_categories
.
restrictedTraverse
(
'group/testGroup1'
)
if
sequence
:
sequence
.
edit
(
object
=
objec
t
,
document
=
documen
t
,
group
=
group1
,
)
return
objec
t
return
documen
t
def
stepSetObjectGroup
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Set a group to object
"""
object
=
sequence
.
get
(
'object'
)
# group1 = object.portal_categories.restrictedTraverse('group/testGroup1')
# object.edit(group_value=group1)
object
.
edit
(
group
=
'testGroup1'
)
document
=
sequence
.
get
(
'document'
)
document
.
edit
(
group
=
'testGroup1'
)
self
.
assertNotEqual
(
objec
t
.
getGroup
(
portal_type
=
()),
documen
t
.
getGroup
(
portal_type
=
()),
None
)
def
stepSetObjectGroupOrganisation
(
self
,
sequence
=
None
,
...
...
@@ -141,11 +139,11 @@ class TestConstraint(PropertySheetTestCase):
"""
Set a group to object, forcing portal_type color to Organisation
"""
object
=
sequence
.
get
(
'objec
t'
)
object
.
setGroup
(
objec
t
.
getRelativeUrl
(),
document
=
sequence
.
get
(
'documen
t'
)
document
.
setGroup
(
documen
t
.
getRelativeUrl
(),
portal_type
=
'Organisation'
)
self
.
assertNotEqual
(
objec
t
.
getGroup
(
portal_type
=
'Organisation'
),
documen
t
.
getGroup
(
portal_type
=
'Organisation'
),
None
)
def
stepSetObjectGroupList
(
self
,
sequence
=
None
,
...
...
@@ -153,68 +151,65 @@ class TestConstraint(PropertySheetTestCase):
"""
Set a group to object
"""
object
=
sequence
.
get
(
'object'
)
# group1 = object.portal_categories.restrictedTraverse('group/testGroup1')
# group2 = object.portal_categories.restrictedTraverse('group/testGroup2')
# object.edit(group_value_list=[group1, group2])
object
.
edit
(
group_list
=
[
'testGroup1'
,
'testGroup2'
])
document
=
sequence
.
get
(
'document'
)
document
.
edit
(
group_list
=
[
'testGroup1'
,
'testGroup2'
])
def
stepSetObjectTitle
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Set a different title value
"""
object
=
sequence
.
get
(
'objec
t'
)
document
=
sequence
.
get
(
'documen
t'
)
object_title
=
self
.
object_title
objec
t
.
setTitle
(
object_title
)
documen
t
.
setTitle
(
object_title
)
def
stepSetObjectNoneTitle
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Set a different title value
"""
object
=
sequence
.
get
(
'objec
t'
)
document
=
sequence
.
get
(
'documen
t'
)
# Do not call edit, as we want to explicitely modify the property
# (and edit modify only if value is different)
objec
t
.
setTitle
(
None
)
documen
t
.
setTitle
(
None
)
def
stepSetObjectEmptyTitle
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Set a different title value
"""
object
=
sequence
.
get
(
'objec
t'
)
document
=
sequence
.
get
(
'documen
t'
)
# Do not call edit, as we want to explicitely modify the property
# (and edit modify only if value is different)
objec
t
.
setTitle
(
''
)
documen
t
.
setTitle
(
''
)
def
stepSetObjectIntTitle
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Set a different title value
"""
object
=
sequence
.
get
(
'objec
t'
)
objec
t
.
edit
(
title
=
12345
)
document
=
sequence
.
get
(
'documen
t'
)
documen
t
.
edit
(
title
=
12345
)
def
stepSetObjectBadTypedProperty
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Set a property with a bad type
"""
object
=
sequence
.
get
(
'objec
t'
)
document
=
sequence
.
get
(
'documen
t'
)
property_name
=
'ean13code'
# make sure the property is defined on the
objec
t
self
.
assertTrue
(
not
objec
t
.
hasProperty
(
property_name
))
self
.
assertTrue
(
objec
t
.
getPropertyType
(
property_name
)
!=
'int'
)
objec
t
.
setProperty
(
property_name
,
12
)
# make sure the property is defined on the
documen
t
self
.
assertTrue
(
not
documen
t
.
hasProperty
(
property_name
))
self
.
assertTrue
(
documen
t
.
getPropertyType
(
property_name
)
!=
'int'
)
documen
t
.
setProperty
(
property_name
,
12
)
def
stepSetObjectIntLocalProperty
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Set a local property on the
objec
t, with an int type.
Set a local property on the
documen
t, with an int type.
"""
object
=
sequence
.
get
(
'objec
t'
)
objec
t
.
edit
(
local_prop
=
12345
)
document
=
sequence
.
get
(
'documen
t'
)
documen
t
.
edit
(
local_prop
=
12345
)
def
_createGenericConstraint
(
self
,
sequence
=
None
,
klass_name
=
'Constraint'
,
**
kw
):
...
...
@@ -225,9 +220,7 @@ class TestConstraint(PropertySheetTestCase):
module
=
Constraint
file_path
=
"%s.%s"
%
(
module
.
__name__
,
klass_name
)
__import__
(
file_path
)
file
=
getattr
(
module
,
klass_name
)
klass
=
file
# klass = getattr(file, klass_name)
klass
=
getattr
(
module
,
klass_name
)
constraint
=
klass
(
**
kw
)
if
sequence
is
not
None
:
sequence
.
edit
(
constraint
=
constraint
,)
...
...
@@ -238,10 +231,10 @@ class TestConstraint(PropertySheetTestCase):
"""
Call checkConsistency of a Constraint.
"""
object
=
sequence
.
get
(
'objec
t'
)
document
=
sequence
.
get
(
'documen
t'
)
constraint
=
sequence
.
get
(
'constraint'
)
# Check
error_list
=
constraint
.
checkConsistency
(
objec
t
)
error_list
=
constraint
.
checkConsistency
(
documen
t
)
sequence
.
edit
(
error_list
=
error_list
)
...
...
@@ -251,10 +244,10 @@ class TestConstraint(PropertySheetTestCase):
"""
Call checkConsistency of a Constraint, fixing the errors.
"""
object
=
sequence
.
get
(
'objec
t'
)
document
=
sequence
.
get
(
'documen
t'
)
constraint
=
sequence
.
get
(
'constraint'
)
# Check
error_list
=
constraint
.
checkConsistency
(
objec
t
,
fixit
=
1
)
error_list
=
constraint
.
checkConsistency
(
documen
t
,
fixit
=
1
)
sequence
.
edit
(
error_list
=
error_list
)
...
...
@@ -264,10 +257,10 @@ class TestConstraint(PropertySheetTestCase):
"""
Call checkConsistency of a Constraint.
"""
objec
t
=
sequence
.
get
(
'group'
)
documen
t
=
sequence
.
get
(
'group'
)
constraint
=
sequence
.
get
(
'constraint'
)
# Check
error_list
=
constraint
.
checkConsistency
(
objec
t
)
error_list
=
constraint
.
checkConsistency
(
documen
t
)
sequence
.
edit
(
error_list
=
error_list
)
...
...
@@ -1327,8 +1320,8 @@ class TestConstraint(PropertySheetTestCase):
"""
Create a Content Object inside one Object
"""
object
=
sequence
.
get
(
'objec
t'
)
content_object
=
objec
t
.
newContent
(
portal_type
=
self
.
object_content_portal_type
)
document
=
sequence
.
get
(
'documen
t'
)
content_object
=
documen
t
.
newContent
(
portal_type
=
self
.
object_content_portal_type
)
sequence
.
edit
(
content_object
=
content_object
,
)
...
...
@@ -1373,20 +1366,20 @@ class TestConstraint(PropertySheetTestCase):
"""
Set valid Title to Object
"""
object
=
sequence
.
get
(
'objec
t'
)
objec
t
.
setTitle
(
self
.
object_title
)
document
=
sequence
.
get
(
'documen
t'
)
documen
t
.
setTitle
(
self
.
object_title
)
sequence
.
edit
(
object
=
objec
t
,
document
=
documen
t
,
)
def
stepSetObjectTitle1
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Set empty (or invalid string) to Object
"""
object
=
sequence
.
get
(
'objec
t'
)
objec
t
.
setTitle
(
' '
)
document
=
sequence
.
get
(
'documen
t'
)
documen
t
.
setTitle
(
' '
)
sequence
.
edit
(
object
=
objec
t
,
document
=
documen
t
,
)
def
test_StringAttributeMatchConstraint
(
self
):
...
...
@@ -1527,13 +1520,13 @@ class TestConstraint(PropertySheetTestCase):
def
stepValidateObject
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
"""
document
=
sequence
.
get
(
'
objec
t'
)
document
=
sequence
.
get
(
'
documen
t'
)
document
.
validate
()
def
stepInvalidateObject
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
"""
document
=
sequence
.
get
(
'
objec
t'
)
document
=
sequence
.
get
(
'
documen
t'
)
document
.
invalidate
()
def
stepCreateAttributeUnicityConstraint
(
self
,
sequence
=
None
,
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testConstraint.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testConstraint
</string>
</value>
...
...
@@ -43,26 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 52, 2: Arguments number differs from overridden \'login\' method (arguments-differ)
</string>
<string>
W:117, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:131, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:144, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:156, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:167, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:176, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:186, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:196, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:204, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:216, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:228, 4: Redefining built-in \'file\' (redefined-builtin)
</string>
<string>
W:241, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:254, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:267, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:1330, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:1376, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
<string>
W:1386, 4: Redefining built-in \'object\' (redefined-builtin)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -72,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -91,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -100,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Category.py
View file @
8d8066c9
...
...
@@ -28,7 +28,7 @@
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
AccessControl.SecurityManagement
import
newSecurityManager
class
TestERP5Category
(
ERP5TypeTestCase
):
...
...
@@ -64,7 +64,6 @@ class TestERP5Category(ERP5TypeTestCase):
return
self
.
getSalePackingListModule
()[
'1'
]
def
afterSetUp
(
self
):
self
.
login
()
# This add the base category size
portal_categories
=
self
.
getCategoryTool
()
person_module
=
self
.
getPersonModule
()
...
...
@@ -155,12 +154,6 @@ class TestERP5Category(ERP5TypeTestCase):
self
.
commitAndTic
()
def
login
(
self
):
uf
=
self
.
getPortal
().
acl_users
uf
.
_doAddUser
(
'seb'
,
''
,
[
'Manager'
],
[])
user
=
uf
.
getUserById
(
'seb'
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
def
commitAndTic
(
self
):
"""Just to save one line.
"""
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Category.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testERP5Category
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.tests.testERP5Category
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testERP5Category
</string>
</value>
...
...
@@ -37,9 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W:158, 2: Arguments number differs from overridden \'login\' method (arguments-differ)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -49,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -68,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -77,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Core.py
View file @
8d8066c9
...
...
@@ -65,7 +65,7 @@ if 1: # BBB
*
args
,
**
kw
)
def
setGlobalTranslationService
(
translation_service
):
global
global_translation_service
global
global_translation_service
# pylint:disable=global-statement
global_translation_service
=
translation_service
zope
.
component
.
provideUtility
(
DummyTranslationDomainFallback
,
provides
=
IFallbackTranslationDomainFactory
)
...
...
@@ -578,9 +578,8 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
0
!=
i
.
getUid
()
!=
i
.
getProperty
(
'uid'
)])
def
test_04_site_manager_and_translation_migration
(
self
):
from
zope.site.hooks
import
getSite
,
setSite
from
zope.site.hooks
import
setSite
from
zope.component
import
queryUtility
from
zope.i18n.interfaces
import
ITranslationDomain
# check translation is working normaly
erp5_ui_catalog
=
self
.
portal
.
Localizer
.
erp5_ui
self
.
assertEqual
(
queryUtility
(
ITranslationDomain
,
'erp5_ui'
),
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Core.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testERP5Core
</string>
</value>
...
...
@@ -43,10 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 67, 4: Using the global statement (global-statement)
</string>
<string>
W:578, 4: Redefining name \'ITranslationDomain\' from outer scope (line 53) (redefined-outer-name)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -56,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -75,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -84,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Workflow.py
View file @
8d8066c9
...
...
@@ -99,8 +99,6 @@ class TestERP5Workflow(ERP5TypeTestCase):
transition2
.
setReference
(
'transition2'
)
state1
.
setDestinationValueList
([
transition1
,
transition2
])
self
.
portal
.
portal_types
.
Folder
.
setTypeWorkflowList
([
'wf'
])
doc
=
self
.
portal
.
newContent
(
portal_type
=
'Folder'
,
id
=
'test_doc'
)
self
.
assertEqual
([
transition1
,
transition2
],
state1
.
getDestinationValueList
())
...
...
@@ -231,6 +229,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
"""
workflow
=
self
.
workflow_module
.
newContent
(
portal_type
=
'Workflow'
)
state
=
workflow
.
newContent
(
portal_type
=
'Workflow State'
,
title
=
'Some State'
)
state
.
Base_viewDict
()
transition
=
workflow
.
newContent
(
portal_type
=
'Workflow Transition'
,
title
=
'Some Transition'
)
transition
.
setReference
(
'change_something'
)
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Workflow.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testERP5Workflow
</string>
</value>
...
...
@@ -53,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -72,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -81,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFolder.py
View file @
8d8066c9
...
...
@@ -40,261 +40,261 @@ from zExceptions import Unauthorized
class
TestFolder
(
ERP5TypeTestCase
,
LogInterceptor
):
# Some helper methods
# Some helper methods
def
getTitle
(
self
):
return
"Folder"
def
getTitle
(
self
):
return
"Folder"
def
getBusinessTemplateList
(
self
):
"""
Return the list of business templates.
"""
return
tuple
()
def
getBusinessTemplateList
(
self
):
"""
Return the list of business templates.
"""
return
tuple
()
def
afterSetUp
(
self
):
"""
Executed before each test_*.
"""
self
.
login
()
self
.
folder
=
self
.
portal
.
newContent
(
id
=
'TestFolder'
,
portal_type
=
'Folder'
)
self
.
other_folder
=
self
.
portal
.
newContent
(
id
=
'OtherTestFolder'
,
portal_type
=
'Folder'
)
def
afterSetUp
(
self
):
"""
Executed before each test_*.
"""
self
.
login
()
self
.
folder
=
self
.
portal
.
newContent
(
id
=
'TestFolder'
,
portal_type
=
'Folder'
)
self
.
other_folder
=
self
.
portal
.
newContent
(
id
=
'OtherTestFolder'
,
portal_type
=
'Folder'
)
def
beforeTearDown
(
self
):
"""
Executed after each test_*.
"""
self
.
portal
.
manage_delObjects
(
ids
=
[
self
.
folder
.
getId
(),
self
.
other_folder
.
getId
()])
clearCache
()
self
.
commit
()
def
beforeTearDown
(
self
):
"""
Executed after each test_*.
"""
self
.
portal
.
manage_delObjects
(
ids
=
[
self
.
folder
.
getId
(),
self
.
other_folder
.
getId
()])
clearCache
()
self
.
commit
()
def
newContent
(
self
):
"""
Create an object in self.folder and return it.
"""
return
self
.
folder
.
newContent
(
portal_type
=
'Folder'
)
def
newContent
(
self
):
"""
Create an object in self.folder and return it.
"""
return
self
.
folder
.
newContent
(
portal_type
=
'Folder'
)
def
test_01_folderType
(
self
):
"""
Test if the present Folder class is the ERP5 version of Folder, not
CMF's.
"""
self
.
assertTrue
(
isinstance
(
self
.
getTypesTool
()[
'Folder'
],
ERP5TypeInformation
))
def
test_01_folderType
(
self
):
"""
Test if the present Folder class is the ERP5 version of Folder, not
CMF's.
"""
self
.
assertTrue
(
isinstance
(
self
.
getTypesTool
()[
'Folder'
],
ERP5TypeInformation
))
def
test_02_defaultGenerateNewId
(
self
):
"""
Test the default Id generation method.
Ids are incremented at content creation and start at 1.
"""
# No id generator defined
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj
=
self
.
newContent
()
self
.
assertEqual
(
obj
.
getId
(),
'1'
)
obj
=
self
.
newContent
()
self
.
assertEqual
(
obj
.
getId
(),
'2'
)
def
test_02_defaultGenerateNewId
(
self
):
"""
Test the default Id generation method.
Ids are incremented at content creation and start at 1.
"""
# No id generator defined
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj
=
self
.
newContent
()
self
.
assertEqual
(
obj
.
getId
(),
'1'
)
obj
=
self
.
newContent
()
self
.
assertEqual
(
obj
.
getId
(),
'2'
)
def
test_03_customGenerateNewId
(
self
):
"""
Test that id_generator property is honored.
"""
id_generator_script_name
=
'testIdGenerator'
id_generator_id_list
=
[
'first_id'
,
'second_id'
]
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
erp5_core
,
id_generator_script_name
,
''
,
'return %s[len(context)]'
%
(
repr
(
id_generator_id_list
),
))
self
.
folder
.
setIdGenerator
(
id_generator_script_name
)
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
id_generator_script_name
)
for
expected_length
in
xrange
(
len
(
id_generator_id_list
)):
self
.
assertEqual
(
len
(
self
.
folder
),
expected_length
)
obj
=
self
.
newContent
()
self
.
assertEqual
(
obj
.
getId
(),
id_generator_id_list
[
expected_length
])
def
test_03_customGenerateNewId
(
self
):
"""
Test that id_generator property is honored.
"""
id_generator_script_name
=
'testIdGenerator'
id_generator_id_list
=
[
'first_id'
,
'second_id'
]
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
erp5_core
,
id_generator_script_name
,
''
,
'return %s[len(context)]'
%
(
repr
(
id_generator_id_list
),
))
self
.
folder
.
setIdGenerator
(
id_generator_script_name
)
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
id_generator_script_name
)
for
expected_length
in
xrange
(
len
(
id_generator_id_list
)):
self
.
assertEqual
(
len
(
self
.
folder
),
expected_length
)
obj
=
self
.
newContent
()
self
.
assertEqual
(
obj
.
getId
(),
id_generator_id_list
[
expected_length
])
def
test_03_unkownGenerateNewId
(
self
):
self
.
folder
.
setIdGenerator
(
'no such method'
)
self
.
assertRaises
(
ValueError
,
self
.
folder
.
generateNewId
)
self
.
assertRaises
(
ValueError
,
self
.
folder
.
newContent
)
def
test_03_unkownGenerateNewId
(
self
):
self
.
folder
.
setIdGenerator
(
'no such method'
)
self
.
assertRaises
(
ValueError
,
self
.
folder
.
generateNewId
)
self
.
assertRaises
(
ValueError
,
self
.
folder
.
newContent
)
def
_setAllowedContentTypesForFolderType
(
self
,
allowed_content_type_list
):
"""Set allowed content types for Folder portal type."""
self
.
getTypesTool
().
Folder
.
edit
(
type_allowed_content_type_list
=
allowed_content_type_list
,
type_filter_content_type
=
True
)
def
_setAllowedContentTypesForFolderType
(
self
,
allowed_content_type_list
):
"""Set allowed content types for Folder portal type."""
self
.
getTypesTool
().
Folder
.
edit
(
type_allowed_content_type_list
=
allowed_content_type_list
,
type_filter_content_type
=
True
)
def
_assertAllowedContentTypes
(
self
,
obj
,
expected_allowed_content_types
):
"""Asserts that allowed content types for obj are exactly what we
have in expected_allowed_content_types."""
self
.
assertEqual
(
sorted
(
expected_allowed_content_types
),
sorted
(
x
.
getId
()
for
x
in
obj
.
allowedContentTypes
()))
def
_assertAllowedContentTypes
(
self
,
obj
,
expected_allowed_content_types
):
"""Asserts that allowed content types for obj are exactly what we
have in expected_allowed_content_types."""
self
.
assertEqual
(
sorted
(
expected_allowed_content_types
),
sorted
(
x
.
getId
()
for
x
in
obj
.
allowedContentTypes
()))
def
test_AllowedContentTypes
(
self
):
type_list
=
[
'Folder'
,
'Category'
,
'Base Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
self
.
_assertAllowedContentTypes
(
self
.
folder
,
type_list
)
def
test_AllowedContentTypes
(
self
):
type_list
=
[
'Folder'
,
'Category'
,
'Base Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
self
.
_assertAllowedContentTypes
(
self
.
folder
,
type_list
)
def
test_AllowedContentTypesCacheExpiration
(
self
):
type_list
=
[
'Folder'
,
'Category'
,
'Base Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
self
.
folder
.
manage_permission
(
'Add portal content'
,
roles
=
[],
acquire
=
0
)
self
.
_assertAllowedContentTypes
(
self
.
folder
,
[])
self
.
folder
.
manage_permission
(
'Add portal content'
,
roles
=
[
'Manager'
],
acquire
=
0
)
self
.
_assertAllowedContentTypes
(
self
.
folder
,
type_list
)
def
test_AllowedContentTypesCacheExpiration
(
self
):
type_list
=
[
'Folder'
,
'Category'
,
'Base Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
self
.
folder
.
manage_permission
(
'Add portal content'
,
roles
=
[],
acquire
=
0
)
self
.
_assertAllowedContentTypes
(
self
.
folder
,
[])
self
.
folder
.
manage_permission
(
'Add portal content'
,
roles
=
[
'Manager'
],
acquire
=
0
)
self
.
_assertAllowedContentTypes
(
self
.
folder
,
type_list
)
def
test_AllowedContentTypesObjectIndependance
(
self
):
type_list
=
[
'Folder'
,
'Category'
,
'Base Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
self
.
_assertAllowedContentTypes
(
self
.
folder
,
type_list
)
self
.
other_folder
.
manage_permission
(
'Add portal content'
,
roles
=
[],
acquire
=
0
)
self
.
_assertAllowedContentTypes
(
self
.
other_folder
,
[])
self
.
_assertAllowedContentTypes
(
self
.
folder
,
type_list
)
def
test_AllowedContentTypesObjectIndependance
(
self
):
type_list
=
[
'Folder'
,
'Category'
,
'Base Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
self
.
_assertAllowedContentTypes
(
self
.
folder
,
type_list
)
self
.
other_folder
.
manage_permission
(
'Add portal content'
,
roles
=
[],
acquire
=
0
)
self
.
_assertAllowedContentTypes
(
self
.
other_folder
,
[])
self
.
_assertAllowedContentTypes
(
self
.
folder
,
type_list
)
def
test_NewContentAndAllowedContentTypes
(
self
):
self
.
_setAllowedContentTypesForFolderType
((
'Folder'
,
))
self
.
assertRaises
(
ValueError
,
self
.
folder
.
newContent
,
portal_type
=
'Category'
)
def
test_NewContentAndAllowedContentTypes
(
self
):
self
.
_setAllowedContentTypesForFolderType
((
'Folder'
,
))
self
.
assertRaises
(
ValueError
,
self
.
folder
.
newContent
,
portal_type
=
'Category'
)
def
test_editWithoutModifyPortalContent
(
self
):
edit
=
guarded_getattr
(
self
.
folder
,
'edit'
)
original_permission_list
=
self
.
folder
.
permission_settings
(
'Modify portal content'
)
assert
len
(
original_permission_list
)
==
1
self
.
folder
.
manage_permission
(
'Modify portal content'
,
[],
0
)
self
.
assertRaises
(
Unauthorized
,
guarded_getattr
,
self
.
folder
,
'edit'
)
# Reset to original permissions
self
.
folder
.
manage_permission
(
'Modify portal content'
,
original_permission_list
[
0
][
'roles'
],
original_permission_list
[
0
][
'acquire'
])
def
test_editWithoutModifyPortalContent
(
self
):
_
=
guarded_getattr
(
self
.
folder
,
'edit'
)
original_permission_list
=
self
.
folder
.
permission_settings
(
'Modify portal content'
)
assert
len
(
original_permission_list
)
==
1
self
.
folder
.
manage_permission
(
'Modify portal content'
,
[],
0
)
self
.
assertRaises
(
Unauthorized
,
guarded_getattr
,
self
.
folder
,
'edit'
)
# Reset to original permissions
self
.
folder
.
manage_permission
(
'Modify portal content'
,
original_permission_list
[
0
][
'roles'
],
original_permission_list
[
0
][
'acquire'
])
def
_createUpgradeObjectClassPythonScript
(
self
):
"""Create a simple python script """
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
"test_upgradeObject"
,
'x'
,
'return [1]'
)
return
self
.
portal
.
portal_skins
.
custom
.
test_upgradeObject
def
_createUpgradeObjectClassPythonScript
(
self
):
"""Create a simple python script """
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
"test_upgradeObject"
,
'x'
,
'return [1]'
)
return
self
.
portal
.
portal_skins
.
custom
.
test_upgradeObject
def
test_upgradeObjectClass
(
self
):
""" Test if it changes Object Class """
type_list
=
[
'Folder'
,
'Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
obj
=
self
.
folder
.
newContent
(
portal_type
=
"Category"
)
from_class
=
obj
.
__class__
to_class
=
self
.
folder
.
__class__
test_script
=
self
.
_createUpgradeObjectClassPythonScript
()
result
=
self
.
folder
.
upgradeObjectClass
(
test_script
,
from_class
,
to_class
,
test_script
)
self
.
commit
()
self
.
assertEqual
(
self
.
folder
[
obj
.
getId
()].
__class__
,
to_class
)
self
.
assertNotEquals
(
self
.
folder
[
obj
.
getId
()].
__class__
,
from_class
)
self
.
assertEqual
([
1
],
result
)
def
test_upgradeObjectClass
(
self
):
""" Test if it changes Object Class """
type_list
=
[
'Folder'
,
'Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
obj
=
self
.
folder
.
newContent
(
portal_type
=
"Category"
)
from_class
=
obj
.
__class__
to_class
=
self
.
folder
.
__class__
test_script
=
self
.
_createUpgradeObjectClassPythonScript
()
result
=
self
.
folder
.
upgradeObjectClass
(
test_script
,
from_class
,
to_class
,
test_script
)
self
.
commit
()
self
.
assertEqual
(
self
.
folder
[
obj
.
getId
()].
__class__
,
to_class
)
self
.
assertNotEquals
(
self
.
folder
[
obj
.
getId
()].
__class__
,
from_class
)
self
.
assertEqual
([
1
],
result
)
def
test_upgradeObjectClassOnlyTest
(
self
):
""" Test if it DOES NOT change Object Class, only test it. """
type_list
=
[
'Folder'
,
'Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
obj
=
self
.
folder
.
newContent
(
portal_type
=
"Category"
)
from_class
=
obj
.
__class__
to_class
=
self
.
folder
.
__class__
test_script
=
self
.
_createUpgradeObjectClassPythonScript
()
result
=
self
.
folder
.
upgradeObjectClass
(
test_script
,
from_class
,
to_class
,
test_script
,
test_only
=
1
)
self
.
commit
()
self
.
assertNotEquals
(
self
.
folder
[
obj
.
getId
()].
__class__
,
to_class
)
self
.
assertEqual
(
self
.
folder
[
obj
.
getId
()].
__class__
,
from_class
)
self
.
assertEqual
([
1
],
result
)
def
test_upgradeObjectClassOnlyTest
(
self
):
""" Test if it DOES NOT change Object Class, only test it. """
type_list
=
[
'Folder'
,
'Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
obj
=
self
.
folder
.
newContent
(
portal_type
=
"Category"
)
from_class
=
obj
.
__class__
to_class
=
self
.
folder
.
__class__
test_script
=
self
.
_createUpgradeObjectClassPythonScript
()
result
=
self
.
folder
.
upgradeObjectClass
(
test_script
,
from_class
,
to_class
,
test_script
,
test_only
=
1
)
self
.
commit
()
self
.
assertNotEquals
(
self
.
folder
[
obj
.
getId
()].
__class__
,
to_class
)
self
.
assertEqual
(
self
.
folder
[
obj
.
getId
()].
__class__
,
from_class
)
self
.
assertEqual
([
1
],
result
)
def
test_upgradeObjectClassHierarchicaly
(
self
):
""" Test if migrate sub objects Hierarchicaly """
type_list
=
[
'Folder'
,
'Category'
,
'Base Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
subfolder
=
self
.
newContent
()
obj
=
subfolder
.
newContent
(
portal_type
=
"Category"
)
from_class
=
obj
.
__class__
to_class
=
self
.
folder
.
__class__
test_script
=
self
.
_createUpgradeObjectClassPythonScript
()
result
=
self
.
folder
.
upgradeObjectClass
(
test_script
,
from_class
,
to_class
,
test_script
)
self
.
commit
()
self
.
assertEqual
(
subfolder
[
obj
.
getId
()].
__class__
,
to_class
)
self
.
assertNotEquals
(
subfolder
[
obj
.
getId
()].
__class__
,
from_class
)
self
.
assertEqual
([
1
],
result
)
def
test_upgradeObjectClassHierarchicaly
(
self
):
""" Test if migrate sub objects Hierarchicaly """
type_list
=
[
'Folder'
,
'Category'
,
'Base Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
subfolder
=
self
.
newContent
()
obj
=
subfolder
.
newContent
(
portal_type
=
"Category"
)
from_class
=
obj
.
__class__
to_class
=
self
.
folder
.
__class__
test_script
=
self
.
_createUpgradeObjectClassPythonScript
()
result
=
self
.
folder
.
upgradeObjectClass
(
test_script
,
from_class
,
to_class
,
test_script
)
self
.
commit
()
self
.
assertEqual
(
subfolder
[
obj
.
getId
()].
__class__
,
to_class
)
self
.
assertNotEquals
(
subfolder
[
obj
.
getId
()].
__class__
,
from_class
)
self
.
assertEqual
([
1
],
result
)
def
test_upgradeObjectClassWithSubObject
(
self
):
""" Test If upgrade preseve subobjects """
type_list
=
[
'Folder'
,
'Category'
,
'Base Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
subobject
=
self
.
folder
.
newContent
(
portal_type
=
"Category"
)
obj
=
subobject
.
newContent
(
portal_type
=
"Category"
)
from_class
=
obj
.
__class__
to_class
=
self
.
folder
.
__class__
test_script
=
self
.
_createUpgradeObjectClassPythonScript
()
result
=
self
.
folder
.
upgradeObjectClass
(
test_script
,
from_class
,
to_class
,
test_script
)
self
.
commit
()
self
.
assertEqual
(
self
.
folder
[
subobject
.
getId
()].
__class__
,
to_class
)
self
.
assertNotEquals
(
self
.
folder
[
subobject
.
getId
()].
__class__
,
from_class
)
self
.
assertEqual
(
self
.
folder
[
subobject
.
getId
()][
obj
.
getId
()].
__class__
,
to_class
)
self
.
assertNotEquals
(
self
.
folder
[
subobject
.
getId
()][
obj
.
getId
()].
__class__
,
from_class
)
self
.
assertEqual
([
1
,
1
],
result
)
def
test_upgradeObjectClassWithSubObject
(
self
):
""" Test If upgrade preseve subobjects """
type_list
=
[
'Folder'
,
'Category'
,
'Base Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
subobject
=
self
.
folder
.
newContent
(
portal_type
=
"Category"
)
obj
=
subobject
.
newContent
(
portal_type
=
"Category"
)
from_class
=
obj
.
__class__
to_class
=
self
.
folder
.
__class__
test_script
=
self
.
_createUpgradeObjectClassPythonScript
()
result
=
self
.
folder
.
upgradeObjectClass
(
test_script
,
from_class
,
to_class
,
test_script
)
self
.
commit
()
self
.
assertEqual
(
self
.
folder
[
subobject
.
getId
()].
__class__
,
to_class
)
self
.
assertNotEquals
(
self
.
folder
[
subobject
.
getId
()].
__class__
,
from_class
)
self
.
assertEqual
(
self
.
folder
[
subobject
.
getId
()][
obj
.
getId
()].
__class__
,
to_class
)
self
.
assertNotEquals
(
self
.
folder
[
subobject
.
getId
()][
obj
.
getId
()].
__class__
,
from_class
)
self
.
assertEqual
([
1
,
1
],
result
)
def
test_upgradeObjectClassWithStrings
(
self
):
""" Test if it changes Object Class """
type_list
=
[
'Folder'
,
'Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
obj
=
self
.
folder
.
newContent
(
portal_type
=
"Category"
)
from_class_as_string
=
'erp5.portal_type.Category'
to_class_as_string
=
'erp5.portal_type.Folder'
from_class
=
obj
.
__class__
to_class
=
self
.
folder
.
__class__
test_script
=
self
.
_createUpgradeObjectClassPythonScript
()
result
=
self
.
folder
.
upgradeObjectClass
(
test_script
,
from_class_as_string
,
to_class_as_string
,
test_script
)
self
.
commit
()
self
.
assertEqual
(
self
.
folder
[
obj
.
getId
()].
__class__
,
to_class
)
self
.
assertNotEquals
(
self
.
folder
[
obj
.
getId
()].
__class__
,
from_class
)
self
.
assertEqual
([
1
],
result
)
def
test_upgradeObjectClassWithStrings
(
self
):
""" Test if it changes Object Class """
type_list
=
[
'Folder'
,
'Category'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
obj
=
self
.
folder
.
newContent
(
portal_type
=
"Category"
)
from_class_as_string
=
'erp5.portal_type.Category'
to_class_as_string
=
'erp5.portal_type.Folder'
from_class
=
obj
.
__class__
to_class
=
self
.
folder
.
__class__
test_script
=
self
.
_createUpgradeObjectClassPythonScript
()
result
=
self
.
folder
.
upgradeObjectClass
(
test_script
,
from_class_as_string
,
to_class_as_string
,
test_script
)
self
.
commit
()
self
.
assertEqual
(
self
.
folder
[
obj
.
getId
()].
__class__
,
to_class
)
self
.
assertNotEquals
(
self
.
folder
[
obj
.
getId
()].
__class__
,
from_class
)
self
.
assertEqual
([
1
],
result
)
def
test_FolderMixinSecurity
(
self
):
""" Test if FolderMix methods cannot be called by URL """
type_list
=
[
'Folder'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
obj
=
self
.
folder
.
newContent
(
portal_type
=
'Folder'
)
self
.
commit
()
response
=
self
.
publish
(
'%s/deleteContent?id=%s'
%
(
self
.
folder
.
absolute_url
(
relative
=
True
),
obj
.
getId
()))
self
.
assertTrue
(
obj
.
getId
()
in
self
.
folder
.
objectIds
())
self
.
assertEqual
(
302
,
response
.
getStatus
())
def
test_FolderMixinSecurity
(
self
):
""" Test if FolderMix methods cannot be called by URL """
type_list
=
[
'Folder'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
obj
=
self
.
folder
.
newContent
(
portal_type
=
'Folder'
)
self
.
commit
()
response
=
self
.
publish
(
'%s/deleteContent?id=%s'
%
(
self
.
folder
.
absolute_url
(
relative
=
True
),
obj
.
getId
()))
self
.
assertTrue
(
obj
.
getId
()
in
self
.
folder
.
objectIds
())
self
.
assertEqual
(
302
,
response
.
getStatus
())
def
test_fragmentedLength
(
self
):
"""Test Folder._count type and behaviour"""
type_list
=
[
'Folder'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
folder
=
self
.
folder
folder_dict
=
folder
.
__dict__
folder
.
newContent
(
portal_type
=
'Folder'
)
self
.
assertEqual
(
len
(
folder
),
1
)
self
.
assertIsInstance
(
folder_dict
[
'_count'
],
Length
)
original_length_oid
=
folder_dict
[
'_count'
].
_p_oid
for
_
in
xrange
(
FRAGMENTED_LENGTH_THRESHOLD
-
len
(
folder
)
-
1
):
folder
.
newContent
(
portal_type
=
'Folder'
)
self
.
assertEqual
(
len
(
folder
),
FRAGMENTED_LENGTH_THRESHOLD
-
1
)
self
.
assertIsInstance
(
folder_dict
[
'_count'
],
Length
)
# Generate 3 to completely clear the threshold, as we do not care whether
# the change happens when reaching the threshold or when going over it.
folder
.
newContent
(
portal_type
=
'Folder'
)
folder
.
newContent
(
portal_type
=
'Folder'
)
def
test_fragmentedLength
(
self
):
"""Test Folder._count type and behaviour"""
type_list
=
[
'Folder'
]
self
.
_setAllowedContentTypesForFolderType
(
type_list
)
folder
=
self
.
folder
folder_dict
=
folder
.
__dict__
folder
.
newContent
(
portal_type
=
'Folder'
)
self
.
assertEqual
(
len
(
folder
),
1
)
self
.
assertIsInstance
(
folder_dict
[
'_count'
],
Length
)
original_length_oid
=
folder_dict
[
'_count'
].
_p_oid
for
_
in
xrange
(
FRAGMENTED_LENGTH_THRESHOLD
-
len
(
folder
)
-
1
):
folder
.
newContent
(
portal_type
=
'Folder'
)
self
.
assertEqual
(
len
(
folder
),
FRAGMENTED_LENGTH_THRESHOLD
+
2
)
fragmented_length
=
folder_dict
[
'_count'
]
self
.
assertIsInstance
(
fragmented_length
,
FragmentedLength
)
self
.
assertEqual
(
len
(
fragmented_length
.
_map
),
2
,
fragmented_length
.
_map
)
original_length
=
fragmented_length
.
_map
[
None
]
self
.
assertEqual
(
original_length_oid
,
original_length
.
_p_oid
)
self
.
assertGreater
(
original_length
(),
FRAGMENTED_LENGTH_THRESHOLD
-
1
)
self
.
assertGreater
(
len
(
folder
),
original_length
())
self
.
assertEqual
(
len
(
folder
),
FRAGMENTED_LENGTH_THRESHOLD
-
1
)
self
.
assertIsInstance
(
folder_dict
[
'_count'
],
Length
)
# Generate 3 to completely clear the threshold, as we do not care whether
# the change happens when reaching the threshold or when going over it.
folder
.
newContent
(
portal_type
=
'Folder'
)
folder
.
newContent
(
portal_type
=
'Folder'
)
folder
.
newContent
(
portal_type
=
'Folder'
)
self
.
assertEqual
(
len
(
folder
),
FRAGMENTED_LENGTH_THRESHOLD
+
2
)
fragmented_length
=
folder_dict
[
'_count'
]
self
.
assertIsInstance
(
fragmented_length
,
FragmentedLength
)
self
.
assertEqual
(
len
(
fragmented_length
.
_map
),
2
,
fragmented_length
.
_map
)
original_length
=
fragmented_length
.
_map
[
None
]
self
.
assertEqual
(
original_length_oid
,
original_length
.
_p_oid
)
self
.
assertGreater
(
original_length
(),
FRAGMENTED_LENGTH_THRESHOLD
-
1
)
self
.
assertGreater
(
len
(
folder
),
original_length
())
def
test_suite
():
suite
=
unittest
.
TestSuite
()
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFolder.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testFolder
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5Type.tests.testFolder
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testFolder
</string>
</value>
...
...
@@ -37,196 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 45, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 46, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 48, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 49, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 52, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 54, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 55, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 58, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 59, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 61, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 64, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 65, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 68, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 70, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 71, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 73, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 74, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 77, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 79, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 80, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 84, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 87, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 88, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 93, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 94, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 95, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 96, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 97, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 98, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:100, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:101, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:104, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:105, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:106, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:109, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:110, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:111, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:112, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W:113, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W:114, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W:116, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:117, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:118, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:119, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:121, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:122, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:123, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:127, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:128, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:130, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:133, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:134, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:135, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:136, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:138, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:139, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:140, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:141, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:143, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:144, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:146, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:148, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:149, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:150, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:151, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:152, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:154, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:155, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:157, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:158, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:159, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:162, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:163, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:164, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:165, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:166, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:167, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:169, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:171, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:172, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:173, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:176, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:179, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:180, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:181, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:182, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:183, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:184, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:185, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:186, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:187, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:189, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:190, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:191, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:192, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:194, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:195, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:196, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:197, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:198, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:199, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:200, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:201, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:202, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:204, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:205, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:206, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:207, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:209, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:210, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:211, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:212, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:213, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:214, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:215, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:216, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:217, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:218, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:220, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:221, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:222, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:223, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:225, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:226, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:227, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:228, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:229, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:230, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:231, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:232, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:233, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:234, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:236, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:237, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:238, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:239, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:240, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:241, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:243, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:244, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:245, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:246, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:247, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:248, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:249, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:250, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:251, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:252, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:253, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:255, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:256, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:257, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:258, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:260, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:261, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:262, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:263, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:264, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:265, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:266, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:268, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:269, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:271, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:272, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:273, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:274, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:275, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:276, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:277, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:278, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:279, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:280, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:281, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:282, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W:283, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:284, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:287, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:288, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:289, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:290, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:291, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:292, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:293, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:294, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:295, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:296, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:297, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:163, 6: Unused variable \'edit\' (unused-variable)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -236,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -255,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -264,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFolderMigration.py
View file @
8d8066c9
...
...
@@ -36,478 +36,478 @@ from Products.ERP5Type.Cache import clearCache
class
TestFolderMigration
(
ERP5TypeTestCase
,
LogInterceptor
):
# Some helper methods
def
getTitle
(
self
):
return
"Folder Migration"
def
getBusinessTemplateList
(
self
):
"""
Return the list of business templates.
"""
return
tuple
()
def
afterSetUp
(
self
):
"""
Executed before each test_*.
"""
self
.
login
()
self
.
folder
=
self
.
portal
.
newContent
(
id
=
'TestFolder'
,
portal_type
=
'Folder'
)
def
beforeTearDown
(
self
):
"""
Executed after each test_*.
"""
self
.
folder
.
manage_delObjects
(
ids
=
list
(
self
.
folder
.
objectIds
()))
self
.
portal
.
manage_delObjects
(
ids
=
[
self
.
folder
.
getId
(),])
clearCache
()
self
.
tic
()
def
newContent
(
self
,
*
args
,
**
kwargs
):
"""
Create an object in self.folder and return it.
"""
return
self
.
folder
.
newContent
(
portal_type
=
'Folder'
,
*
args
,
**
kwargs
)
def
test_01_folderIsBtree
(
self
):
"""
Test the folder is a BTree
"""
self
.
assertRaises
(
NotImplementedError
,
self
.
folder
.
getTreeIdList
)
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
True
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
def
test_02_migrateFolder
(
self
):
"""
migrate folder from btree to hbtree
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
()
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
tic
()
# call migration script
self
.
folder
.
migrateToHBTree
(
migration_generate_id_method
=
"Base_generateIdFromStopDate"
,
new_generate_id_method
=
"_generatePerDayId"
)
self
.
tic
()
# check we now have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
getTreeIdList
()),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
3
)
# check params of objectIds in case of hbtree
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
0
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
None
)),
0
)
# check object ids
from
DateTime
import
DateTime
date
=
DateTime
().
Date
()
date
=
date
.
replace
(
"/"
,
""
)
self
.
assertEqual
(
obj1
.
getId
(),
'%s-1'
%
date
)
self
.
assertEqual
(
obj2
.
getId
(),
'%s-2'
%
date
)
self
.
assertEqual
(
obj3
.
getId
(),
'%s-3'
%
date
)
# add object and check its id
obj4
=
self
.
newContent
()
self
.
assertEqual
(
obj4
.
getId
().
split
(
'-'
)[
0
],
date
)
def
test_03_emptyFolderIsBtree
(
self
):
"""
Test the folder is a BTree
"""
self
.
assertRaises
(
NotImplementedError
,
self
.
folder
.
getTreeIdList
)
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
True
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
def
test_03a_filledFolderIsBtree
(
self
):
"""
Test the folder is a BTree
"""
self
.
folder
.
newContent
()
self
.
assertRaises
(
NotImplementedError
,
self
.
folder
.
getTreeIdList
)
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
True
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
def
test_04_migrateEmptyFolder
(
self
):
"""
migrate empty folder from btree to hbtree
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
0
)
# call migration script
self
.
folder
.
migrateToHBTree
(
migration_generate_id_method
=
None
,
new_generate_id_method
=
"_generatePerDayId"
)
self
.
tic
()
# check we now have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
0
)
# check new object ids
obj1
=
self
.
newContent
()
from
DateTime
import
DateTime
date
=
DateTime
().
Date
()
date
=
date
.
replace
(
"/"
,
""
)
self
.
assertTrue
(
date
in
obj1
.
getId
())
# check we still have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
1
)
def
test_05_migrateFolderWithoutIdChange
(
self
):
"""
migrate folder from btree to hbtree, do not touch ids
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
()
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
tic
()
# call migration script with explicit new_generate_id_method (so migration code
# doesn't assign a good default
self
.
folder
.
migrateToHBTree
(
new_generate_id_method
=
'_generateNextId'
)
self
.
tic
()
# check we now have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
getTreeIdList
()),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
3
)
# check params of objectIds in case of hbtree
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
None
)),
3
)
# check object ids
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
# add object and check its id
obj4
=
self
.
newContent
()
self
.
assertEqual
(
obj4
.
getId
(),
'4'
)
def
test_06_migrateFolderChangeIdGenerationMethodLater
(
self
):
"""
migrate folder from btree to hbtree, do not touch ids
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
()
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
tic
()
# call migration script with explicit new_generate_id_method (so migration code
# doesn't assign a good default
self
.
folder
.
migrateToHBTree
(
new_generate_id_method
=
'_generateNextId'
)
self
.
tic
()
# check we now have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
getTreeIdList
()),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
3
)
# check params of objectIds in case of hbtree
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
None
)),
3
)
# check object ids
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
# add object and check its id
obj4
=
self
.
newContent
()
self
.
assertEqual
(
obj4
.
getId
(),
'4'
)
# set id generator
id_generator_method
=
'_generatePerDayId'
self
.
folder
.
setIdGenerator
(
id_generator_method
)
self
.
commit
()
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
id_generator_method
)
# check object ids
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
assertEqual
(
obj4
.
getId
(),
'4'
)
# add object and check its id
from
DateTime
import
DateTime
date
=
DateTime
().
Date
()
date
=
date
.
replace
(
"/"
,
""
)
obj5
=
self
.
newContent
()
self
.
assertEqual
(
obj5
.
getId
().
split
(
'-'
)[
0
],
date
)
def
test_07_migrateFolderTwice
(
self
):
"""
migrate folder twice from btree to hbtree
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
()
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
tic
()
# call migration script
self
.
folder
.
migrateToHBTree
(
migration_generate_id_method
=
"Base_generateIdFromStopDate"
,
new_generate_id_method
=
"_generatePerDayId"
)
self
.
tic
()
# check we now have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
getTreeIdList
()),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
3
)
# check params of objectIds in case of hbtree
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
0
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
None
)),
0
)
# check object ids
from
DateTime
import
DateTime
date
=
DateTime
().
Date
()
date
=
date
.
replace
(
"/"
,
""
)
self
.
assertEqual
(
obj1
.
getId
(),
'%s-1'
%
date
)
self
.
assertEqual
(
obj2
.
getId
(),
'%s-2'
%
date
)
self
.
assertEqual
(
obj3
.
getId
(),
'%s-3'
%
date
)
# add object and check its id
obj4
=
self
.
newContent
()
self
.
assertEqual
(
obj4
.
getId
().
split
(
'-'
)[
0
],
date
)
# call migration script again
self
.
folder
.
migrateToHBTree
(
migration_generate_id_method
=
"Base_generateIdFromStopDate"
,
new_generate_id_method
=
"_generatePerDayId"
)
self
.
tic
()
# check object ids
self
.
assertEqual
(
obj1
.
getId
(),
'%s-1'
%
date
)
self
.
assertEqual
(
obj2
.
getId
(),
'%s-2'
%
date
)
self
.
assertEqual
(
obj3
.
getId
(),
'%s-3'
%
date
)
self
.
assertEqual
(
obj4
.
getId
().
split
(
'-'
)[
0
],
date
)
def
test_08_migrateFolderTwiceSimultaneously
(
self
):
"""
migrate folder twice from btree to hbtree, simultaneously
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
()
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
tic
()
# call migration script twice
self
.
folder
.
migrateToHBTree
(
migration_generate_id_method
=
"Base_generateIdFromStopDate"
,
new_generate_id_method
=
"_generatePerDayId"
)
self
.
commit
()
self
.
folder
.
migrateToHBTree
(
migration_generate_id_method
=
"Base_generateIdFromStopDate"
,
new_generate_id_method
=
"_generatePerDayId"
)
self
.
tic
()
# check we now have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
getTreeIdList
()),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
3
)
# check params of objectIds in case of hbtree
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
0
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
None
)),
0
)
# check object ids
from
DateTime
import
DateTime
date
=
DateTime
().
Date
()
date
=
date
.
replace
(
"/"
,
""
)
self
.
assertEqual
(
obj1
.
getId
(),
'%s-1'
%
date
)
self
.
assertEqual
(
obj2
.
getId
(),
'%s-2'
%
date
)
self
.
assertEqual
(
obj3
.
getId
(),
'%s-3'
%
date
)
# add object and check its id
obj4
=
self
.
newContent
()
self
.
assertEqual
(
obj4
.
getId
().
split
(
'-'
)[
0
],
date
)
def
test_09_migrateFolderCreateNewObjectAtOnce
(
self
):
"""
migrate folder from btree to hbtree, create object with base, without any
previous checks
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
()
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
tic
()
# call migration script
self
.
folder
.
migrateToHBTree
()
self
.
tic
()
obj4
=
self
.
newContent
(
id
=
'BASE-123'
)
self
.
assertEqual
(
obj4
.
getId
(),
'BASE-123'
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
4
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
None
)),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
'BASE'
)),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
'BASE'
)),
1
)
def
test_10_migrateFolderCreateMoreObjectAtOnceDifferentBase
(
self
):
"""
migrate folder from btree to hbtree, create objects with two bases,
without any previous checks
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
()
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
tic
()
# call migration script
self
.
folder
.
migrateToHBTree
()
self
.
tic
()
obj4
=
self
.
newContent
(
id
=
'BASE-123'
)
obj5
=
self
.
newContent
(
id
=
'BASE-BELONG-123'
)
self
.
assertEqual
(
obj4
.
getId
(),
'BASE-123'
)
self
.
assertEqual
(
obj5
.
getId
(),
'BASE-BELONG-123'
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
5
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
None
)),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
'BASE'
)),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
'BASE'
)),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
'BASE-BELONG'
)),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
'BASE-BELONG'
)),
1
)
def
test_11_folderInMigratedFolderIsBTree
(
self
):
"""
Test the folder in HBTree folder is a BTree
"""
self
.
folder
.
migrateToHBTree
()
self
.
tic
()
infolder
=
self
.
newContent
()
self
.
assertRaises
(
NotImplementedError
,
infolder
.
getTreeIdList
)
self
.
assertEqual
(
infolder
.
isBTree
(),
True
)
self
.
assertEqual
(
infolder
.
isHBTree
(),
False
)
def
test_12_migrateFolderWithGoodIdsInIt
(
self
):
"""
migrate folder from btree to hbtree folder, which already has ids
HBTree-friendly
"""
id_prefix
=
'BASE'
obj1_id
=
'%s-1'
%
(
id_prefix
,)
obj2_id
=
'%s-2'
%
(
id_prefix
,)
obj3_id
=
'%s-3'
%
(
id_prefix
,)
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
(
id
=
obj1_id
)
obj2
=
self
.
newContent
(
id
=
obj2_id
)
obj3
=
self
.
newContent
(
id
=
obj3_id
)
self
.
tic
()
# call migration script
self
.
folder
.
migrateToHBTree
()
self
.
tic
()
# check we now have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
getTreeIdList
()),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
3
)
# check params of objectIds in case of hbtree
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
0
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
id_prefix
)),
3
)
# add object without base
obj4
=
self
.
newContent
(
id
=
'1'
)
self
.
assertEqual
(
obj4
.
getId
(),
'1'
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
4
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
id_prefix
)),
3
)
def
test_13_wrongFolderHandlerFix
(
self
):
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
True
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
self
.
folder
.
_folder_handler
=
'CMFBTreeFolderHandler'
self
.
tic
()
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
_fixFolderHandler
(),
True
)
self
.
commit
()
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
True
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
self
.
folder
.
migrateToHBTree
()
self
.
tic
()
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
def
test_14_wrongFolderHandlerMigrate
(
self
):
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
True
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
self
.
folder
.
_folder_handler
=
'CMFBTreeFolderHandler'
self
.
tic
()
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
self
.
folder
.
migrateToHBTree
()
self
.
tic
()
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
folder
.
newContent
()
self
.
tic
()
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
def
test_15_checkMigrationWorksIfIdsDontChange
(
self
):
"""
migrate folder using a script that leaves some objects with same ids
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
(
id
=
'custom-id'
)
self
.
assertEqual
(
obj3
.
getId
(),
'custom-id'
)
self
.
tic
()
# call migration script Base_generateIdFromCreationDate that only changes int ids
self
.
folder
.
migrateToHBTree
(
migration_generate_id_method
=
"Base_generateIdFromCreationDate"
,
new_generate_id_method
=
"_generatePerDayId"
)
self
.
tic
()
# check object ids
from
DateTime
import
DateTime
date
=
DateTime
().
Date
()
date
=
date
.
replace
(
"/"
,
""
)
#1 y 2 should have new format id (because old ids were int)
self
.
assertEqual
(
obj1
.
getId
(),
'%s-1'
%
date
)
self
.
assertEqual
(
obj2
.
getId
(),
'%s-2'
%
date
)
#3 should have the same old id
self
.
assertEqual
(
obj3
.
getId
(),
'custom-id'
)
# Some helper methods
def
getTitle
(
self
):
return
"Folder Migration"
def
getBusinessTemplateList
(
self
):
"""
Return the list of business templates.
"""
return
tuple
()
def
afterSetUp
(
self
):
"""
Executed before each test_*.
"""
self
.
login
()
self
.
folder
=
self
.
portal
.
newContent
(
id
=
'TestFolder'
,
portal_type
=
'Folder'
)
def
beforeTearDown
(
self
):
"""
Executed after each test_*.
"""
self
.
folder
.
manage_delObjects
(
ids
=
list
(
self
.
folder
.
objectIds
()))
self
.
portal
.
manage_delObjects
(
ids
=
[
self
.
folder
.
getId
(),])
clearCache
()
self
.
tic
()
def
newContent
(
self
,
*
args
,
**
kwargs
):
"""
Create an object in self.folder and return it.
"""
return
self
.
folder
.
newContent
(
portal_type
=
'Folder'
,
*
args
,
**
kwargs
)
def
test_01_folderIsBtree
(
self
):
"""
Test the folder is a BTree
"""
self
.
assertRaises
(
NotImplementedError
,
self
.
folder
.
getTreeIdList
)
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
True
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
def
test_02_migrateFolder
(
self
):
"""
migrate folder from btree to hbtree
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
()
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
tic
()
# call migration script
self
.
folder
.
migrateToHBTree
(
migration_generate_id_method
=
"Base_generateIdFromStopDate"
,
new_generate_id_method
=
"_generatePerDayId"
)
self
.
tic
()
# check we now have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
getTreeIdList
()),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
3
)
# check params of objectIds in case of hbtree
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
0
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
None
)),
0
)
# check object ids
from
DateTime
import
DateTime
date
=
DateTime
().
Date
()
date
=
date
.
replace
(
"/"
,
""
)
self
.
assertEqual
(
obj1
.
getId
(),
'%s-1'
%
date
)
self
.
assertEqual
(
obj2
.
getId
(),
'%s-2'
%
date
)
self
.
assertEqual
(
obj3
.
getId
(),
'%s-3'
%
date
)
# add object and check its id
obj4
=
self
.
newContent
()
self
.
assertEqual
(
obj4
.
getId
().
split
(
'-'
)[
0
],
date
)
def
test_03_emptyFolderIsBtree
(
self
):
"""
Test the folder is a BTree
"""
self
.
assertRaises
(
NotImplementedError
,
self
.
folder
.
getTreeIdList
)
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
True
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
def
test_03a_filledFolderIsBtree
(
self
):
"""
Test the folder is a BTree
"""
self
.
folder
.
newContent
()
self
.
assertRaises
(
NotImplementedError
,
self
.
folder
.
getTreeIdList
)
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
True
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
def
test_04_migrateEmptyFolder
(
self
):
"""
migrate empty folder from btree to hbtree
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
0
)
# call migration script
self
.
folder
.
migrateToHBTree
(
migration_generate_id_method
=
None
,
new_generate_id_method
=
"_generatePerDayId"
)
self
.
tic
()
# check we now have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
0
)
# check new object ids
obj1
=
self
.
newContent
()
from
DateTime
import
DateTime
date
=
DateTime
().
Date
()
date
=
date
.
replace
(
"/"
,
""
)
self
.
assertTrue
(
date
in
obj1
.
getId
())
# check we still have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
1
)
def
test_05_migrateFolderWithoutIdChange
(
self
):
"""
migrate folder from btree to hbtree, do not touch ids
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
()
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
tic
()
# call migration script with explicit new_generate_id_method (so migration code
# doesn't assign a good default
self
.
folder
.
migrateToHBTree
(
new_generate_id_method
=
'_generateNextId'
)
self
.
tic
()
# check we now have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
getTreeIdList
()),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
3
)
# check params of objectIds in case of hbtree
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
None
)),
3
)
# check object ids
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
# add object and check its id
obj4
=
self
.
newContent
()
self
.
assertEqual
(
obj4
.
getId
(),
'4'
)
def
test_06_migrateFolderChangeIdGenerationMethodLater
(
self
):
"""
migrate folder from btree to hbtree, do not touch ids
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
()
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
tic
()
# call migration script with explicit new_generate_id_method (so migration code
# doesn't assign a good default
self
.
folder
.
migrateToHBTree
(
new_generate_id_method
=
'_generateNextId'
)
self
.
tic
()
# check we now have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
getTreeIdList
()),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
3
)
# check params of objectIds in case of hbtree
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
None
)),
3
)
# check object ids
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
# add object and check its id
obj4
=
self
.
newContent
()
self
.
assertEqual
(
obj4
.
getId
(),
'4'
)
# set id generator
id_generator_method
=
'_generatePerDayId'
self
.
folder
.
setIdGenerator
(
id_generator_method
)
self
.
commit
()
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
id_generator_method
)
# check object ids
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
assertEqual
(
obj4
.
getId
(),
'4'
)
# add object and check its id
from
DateTime
import
DateTime
date
=
DateTime
().
Date
()
date
=
date
.
replace
(
"/"
,
""
)
obj5
=
self
.
newContent
()
self
.
assertEqual
(
obj5
.
getId
().
split
(
'-'
)[
0
],
date
)
def
test_07_migrateFolderTwice
(
self
):
"""
migrate folder twice from btree to hbtree
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
()
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
tic
()
# call migration script
self
.
folder
.
migrateToHBTree
(
migration_generate_id_method
=
"Base_generateIdFromStopDate"
,
new_generate_id_method
=
"_generatePerDayId"
)
self
.
tic
()
# check we now have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
getTreeIdList
()),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
3
)
# check params of objectIds in case of hbtree
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
0
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
None
)),
0
)
# check object ids
from
DateTime
import
DateTime
date
=
DateTime
().
Date
()
date
=
date
.
replace
(
"/"
,
""
)
self
.
assertEqual
(
obj1
.
getId
(),
'%s-1'
%
date
)
self
.
assertEqual
(
obj2
.
getId
(),
'%s-2'
%
date
)
self
.
assertEqual
(
obj3
.
getId
(),
'%s-3'
%
date
)
# add object and check its id
obj4
=
self
.
newContent
()
self
.
assertEqual
(
obj4
.
getId
().
split
(
'-'
)[
0
],
date
)
# call migration script again
self
.
folder
.
migrateToHBTree
(
migration_generate_id_method
=
"Base_generateIdFromStopDate"
,
new_generate_id_method
=
"_generatePerDayId"
)
self
.
tic
()
# check object ids
self
.
assertEqual
(
obj1
.
getId
(),
'%s-1'
%
date
)
self
.
assertEqual
(
obj2
.
getId
(),
'%s-2'
%
date
)
self
.
assertEqual
(
obj3
.
getId
(),
'%s-3'
%
date
)
self
.
assertEqual
(
obj4
.
getId
().
split
(
'-'
)[
0
],
date
)
def
test_08_migrateFolderTwiceSimultaneously
(
self
):
"""
migrate folder twice from btree to hbtree, simultaneously
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
()
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
tic
()
# call migration script twice
self
.
folder
.
migrateToHBTree
(
migration_generate_id_method
=
"Base_generateIdFromStopDate"
,
new_generate_id_method
=
"_generatePerDayId"
)
self
.
commit
()
self
.
folder
.
migrateToHBTree
(
migration_generate_id_method
=
"Base_generateIdFromStopDate"
,
new_generate_id_method
=
"_generatePerDayId"
)
self
.
tic
()
# check we now have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
getTreeIdList
()),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
3
)
# check params of objectIds in case of hbtree
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
0
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
None
)),
0
)
# check object ids
from
DateTime
import
DateTime
date
=
DateTime
().
Date
()
date
=
date
.
replace
(
"/"
,
""
)
self
.
assertEqual
(
obj1
.
getId
(),
'%s-1'
%
date
)
self
.
assertEqual
(
obj2
.
getId
(),
'%s-2'
%
date
)
self
.
assertEqual
(
obj3
.
getId
(),
'%s-3'
%
date
)
# add object and check its id
obj4
=
self
.
newContent
()
self
.
assertEqual
(
obj4
.
getId
().
split
(
'-'
)[
0
],
date
)
def
test_09_migrateFolderCreateNewObjectAtOnce
(
self
):
"""
migrate folder from btree to hbtree, create object with base, without any
previous checks
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
()
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
tic
()
# call migration script
self
.
folder
.
migrateToHBTree
()
self
.
tic
()
obj4
=
self
.
newContent
(
id
=
'BASE-123'
)
self
.
assertEqual
(
obj4
.
getId
(),
'BASE-123'
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
4
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
None
)),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
'BASE'
)),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
'BASE'
)),
1
)
def
test_10_migrateFolderCreateMoreObjectAtOnceDifferentBase
(
self
):
"""
migrate folder from btree to hbtree, create objects with two bases,
without any previous checks
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
()
self
.
assertEqual
(
obj3
.
getId
(),
'3'
)
self
.
tic
()
# call migration script
self
.
folder
.
migrateToHBTree
()
self
.
tic
()
obj4
=
self
.
newContent
(
id
=
'BASE-123'
)
obj5
=
self
.
newContent
(
id
=
'BASE-BELONG-123'
)
self
.
assertEqual
(
obj4
.
getId
(),
'BASE-123'
)
self
.
assertEqual
(
obj5
.
getId
(),
'BASE-BELONG-123'
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
5
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
None
)),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
'BASE'
)),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
'BASE'
)),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
'BASE-BELONG'
)),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
'BASE-BELONG'
)),
1
)
def
test_11_folderInMigratedFolderIsBTree
(
self
):
"""
Test the folder in HBTree folder is a BTree
"""
self
.
folder
.
migrateToHBTree
()
self
.
tic
()
infolder
=
self
.
newContent
()
self
.
assertRaises
(
NotImplementedError
,
infolder
.
getTreeIdList
)
self
.
assertEqual
(
infolder
.
isBTree
(),
True
)
self
.
assertEqual
(
infolder
.
isHBTree
(),
False
)
def
test_12_migrateFolderWithGoodIdsInIt
(
self
):
"""
migrate folder from btree to hbtree folder, which already has ids
HBTree-friendly
"""
id_prefix
=
'BASE'
obj1_id
=
'%s-1'
%
(
id_prefix
,)
obj2_id
=
'%s-2'
%
(
id_prefix
,)
obj3_id
=
'%s-3'
%
(
id_prefix
,)
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
self
.
newContent
(
id
=
obj1_id
)
self
.
newContent
(
id
=
obj2_id
)
self
.
newContent
(
id
=
obj3_id
)
self
.
tic
()
# call migration script
self
.
folder
.
migrateToHBTree
()
self
.
tic
()
# check we now have a hbtree
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
assertEqual
(
len
(
self
.
folder
.
getTreeIdList
()),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
()),
3
)
# check params of objectIds in case of hbtree
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
0
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
3
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
id_prefix
)),
3
)
# add object without base
obj4
=
self
.
newContent
(
id
=
'1'
)
self
.
assertEqual
(
obj4
.
getId
(),
'1'
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectIds
(
base_id
=
None
)),
1
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
()),
4
)
self
.
assertEqual
(
len
(
self
.
folder
.
objectValues
(
base_id
=
id_prefix
)),
3
)
def
test_13_wrongFolderHandlerFix
(
self
):
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
True
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
self
.
folder
.
_folder_handler
=
'CMFBTreeFolderHandler'
self
.
tic
()
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
_fixFolderHandler
(),
True
)
self
.
commit
()
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
True
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
self
.
folder
.
migrateToHBTree
()
self
.
tic
()
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
def
test_14_wrongFolderHandlerMigrate
(
self
):
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
True
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
self
.
folder
.
_folder_handler
=
'CMFBTreeFolderHandler'
self
.
tic
()
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
False
)
self
.
folder
.
migrateToHBTree
()
self
.
tic
()
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
self
.
folder
.
newContent
()
self
.
tic
()
self
.
assertEqual
(
self
.
folder
.
isBTree
(),
False
)
self
.
assertEqual
(
self
.
folder
.
isHBTree
(),
True
)
def
test_15_checkMigrationWorksIfIdsDontChange
(
self
):
"""
migrate folder using a script that leaves some objects with same ids
"""
# Create some objects
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
''
)
self
.
assertEqual
(
len
(
self
.
folder
),
0
)
obj1
=
self
.
newContent
()
self
.
assertEqual
(
obj1
.
getId
(),
'1'
)
obj2
=
self
.
newContent
()
self
.
assertEqual
(
obj2
.
getId
(),
'2'
)
obj3
=
self
.
newContent
(
id
=
'custom-id'
)
self
.
assertEqual
(
obj3
.
getId
(),
'custom-id'
)
self
.
tic
()
# call migration script Base_generateIdFromCreationDate that only changes int ids
self
.
folder
.
migrateToHBTree
(
migration_generate_id_method
=
"Base_generateIdFromCreationDate"
,
new_generate_id_method
=
"_generatePerDayId"
)
self
.
tic
()
# check object ids
from
DateTime
import
DateTime
date
=
DateTime
().
Date
()
date
=
date
.
replace
(
"/"
,
""
)
#1 y 2 should have new format id (because old ids were int)
self
.
assertEqual
(
obj1
.
getId
(),
'%s-1'
%
date
)
self
.
assertEqual
(
obj2
.
getId
(),
'%s-2'
%
date
)
#3 should have the same old id
self
.
assertEqual
(
obj3
.
getId
(),
'custom-id'
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFolderMigration.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testFolderMigration
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5Type.tests.testFolderMigration
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testFolderMigration
</string>
</value>
...
...
@@ -37,324 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 41, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 42, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 44, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 45, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 48, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 50, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 51, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 54, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 55, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 58, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 59, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 62, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 63, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 64, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 65, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 67, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 68, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 71, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 73, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 74, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 77, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 78, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 79, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 81, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 82, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 86, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 87, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 88, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 89, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 90, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 91, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 92, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 93, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 94, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 96, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 98, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:100, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:101, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:102, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:103, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:105, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:106, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:107, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:109, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:110, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:111, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:112, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:113, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:114, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:116, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:117, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:119, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:120, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:123, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:124, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:125, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:127, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:128, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:131, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:132, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:133, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:134, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:136, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:137, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:141, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:142, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:143, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:145, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:147, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:149, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:150, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:151, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:153, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:154, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:155, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:156, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:157, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:159, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:160, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:161, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:163, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:164, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:168, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:169, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:170, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:171, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:172, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:173, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:174, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:175, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:176, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:179, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:180, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:182, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:183, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:184, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:185, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:187, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:188, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:189, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:191, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:192, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:193, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:195, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:196, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:198, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:199, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:203, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:204, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:205, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:206, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:207, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:208, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:209, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:210, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:211, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:214, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:215, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:217, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:218, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:219, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:220, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:222, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:223, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:224, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:226, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:227, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:228, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:230, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:231, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:233, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:234, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:235, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:236, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:238, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:239, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:240, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:241, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:243, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:244, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:245, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:247, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:248, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:250, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:251, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:255, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:256, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:257, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:258, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:259, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:260, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:261, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:262, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:263, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:265, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:267, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:269, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:270, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:271, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:272, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:274, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:275, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:276, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:278, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:279, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:280, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:281, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:282, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:283, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:285, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:286, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:288, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:290, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:293, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:294, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:295, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:296, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:298, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:299, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:303, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:304, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:305, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:306, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:307, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:308, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:309, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:310, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:311, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:313, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:315, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:316, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:318, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:320, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:321, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:322, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:323, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:325, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:326, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:327, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:329, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:330, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:331, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:332, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:333, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:334, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:336, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:337, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:339, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:340, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:345, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:346, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:347, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:348, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:349, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:350, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:351, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:352, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:353, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:355, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:356, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:357, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:358, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:359, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:360, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:361, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:362, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:363, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:365, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:366, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:371, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:372, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:373, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:374, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:375, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:376, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:377, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:378, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:379, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:381, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:382, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:383, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:384, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:385, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:386, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:387, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:388, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:389, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:390, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:391, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:392, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:393, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:395, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:396, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:399, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:400, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:401, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:403, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:404, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:405, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:407, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:408, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:412, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:413, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:414, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:415, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:417, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:418, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:419, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:420, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:421, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:422, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:424, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:425, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:427, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:428, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:429, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:430, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:432, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:433, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:434, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:436, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:437, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:438, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:439, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:440, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:442, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:443, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:444, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:446, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:447, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:449, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:451, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:452, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:454, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:455, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:457, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:458, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:460, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:461, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:463, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W:464, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:465, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:467, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:468, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:470, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:472, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:473, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:475, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:476, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:478, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:479, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:481, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:482, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:419, 6: Unused variable \'obj1\' (unused-variable)
</string>
<string>
W:421, 6: Unused variable \'obj3\' (unused-variable)
</string>
<string>
W:420, 6: Unused variable \'obj2\' (unused-variable)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -364,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -383,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -392,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testGeographicalAddress.py
View file @
8d8066c9
...
...
@@ -26,13 +26,11 @@
#
##############################################################################
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
AccessControl.SecurityManagement
import
newSecurityManager
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
class
TestGeographicalAddress
(
ERP5TypeTestCase
):
"""
ERP5 Geographical Address related tests.
...
...
@@ -41,7 +39,6 @@ class TestGeographicalAddress(ERP5TypeTestCase):
on a Geographical Address returns the standard text format.
"""
run_all_test
=
1
entity_portal_type
=
'Person'
address_portal_type
=
'Address'
street_address_text
=
"rue Truc"
...
...
@@ -49,37 +46,7 @@ class TestGeographicalAddress(ERP5TypeTestCase):
zip_code_text
=
"12345"
city_text
=
"City1"
def
getTitle
(
self
):
return
"Geographical Address"
def
getBusinessTemplateList
(
self
):
"""
"""
return
(
'erp5_base'
,
)
def
login
(
self
,
quiet
=
0
,
run
=
run_all_test
):
uf
=
self
.
getPortal
().
acl_users
uf
.
_doAddUser
(
'rc'
,
''
,
[
'Manager'
],
[])
user
=
uf
.
getUserById
(
'rc'
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
def
enableLightInstall
(
self
):
"""
You can override this.
Return if we should do a light install (1) or not (0)
"""
return
1
def
enableActivityTool
(
self
):
"""
You can override this.
Return if we should create (1) or not (0) an activity tool.
"""
return
1
def
afterSetUp
(
self
,
quiet
=
1
,
run
=
run_all_test
):
self
.
login
()
self
.
portal
=
self
.
getPortal
()
def
afterSetUp
(
self
):
self
.
category_tool
=
self
.
getCategoryTool
()
self
.
createCategories
()
...
...
@@ -91,7 +58,7 @@ class TestGeographicalAddress(ERP5TypeTestCase):
region_category_list
=
[
'country1'
,
'country2'
,
]
if
len
(
self
.
category_tool
.
region
.
contentValues
())
==
0
:
for
category_id
in
region_category_list
:
o
=
self
.
category_tool
.
region
.
newContent
(
portal_type
=
'Category'
,
self
.
category_tool
.
region
.
newContent
(
portal_type
=
'Category'
,
id
=
category_id
,
title
=
category_id
.
capitalize
())
self
.
region_category_list
=
[
'region/%s'
%
x
for
x
\
...
...
@@ -101,7 +68,7 @@ class TestGeographicalAddress(ERP5TypeTestCase):
"""
Create an entity
"""
portal
=
self
.
getPortal
()
portal
=
self
.
portal
module
=
portal
.
getDefaultModule
(
self
.
entity_portal_type
)
entity
=
module
.
newContent
(
portal_type
=
self
.
entity_portal_type
)
sequence
.
edit
(
...
...
@@ -141,12 +108,10 @@ class TestGeographicalAddress(ERP5TypeTestCase):
self
.
zip_code_text
,
self
.
city_text
,))
def
test_01_standardAddress
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
test_01_standardAddress
(
self
):
"""
Test property existence
"""
if
not
run
:
return
sequence_list
=
SequenceList
()
sequence_string
=
'
\
CreateEntity
\
...
...
@@ -161,7 +126,7 @@ class TestGeographicalAddress(ERP5TypeTestCase):
"""
This script returns a different address format.
"""
createZODBPythonScript
(
self
.
getPortal
()
.
portal_skins
.
custom
,
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
'Address_asText'
,
''
,
"""
return '%s
\
\
n%s %s COUNTRY' %
\
\
(context.getStreetAddress(),
...
...
@@ -180,12 +145,10 @@ return '%s\\n%s %s COUNTRY' % \\
self
.
zip_code_text
,
self
.
city_text
))
def
test_02_asTextScript
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
test_02_asTextScript
(
self
):
"""
Test property existence
"""
if
not
run
:
return
sequence_list
=
SequenceList
()
sequence_string
=
'
\
CreateEntity
\
...
...
@@ -197,7 +160,3 @@ return '%s\\n%s %s COUNTRY' % \\
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestGeographicalAddress
))
return
suite
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testGeographicalAddress.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testGeographicalAddress
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.tests.testGeographicalAddress
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testGeographicalAddress
</string>
</value>
...
...
@@ -37,10 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 80, 2: Arguments number differs from overridden \'afterSetUp\' method (arguments-differ)
</string>
<string>
W: 94, 8: Unused variable \'o\' (unused-variable)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -50,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -69,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -78,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIdToolUpgrade.py
View file @
8d8066c9
...
...
@@ -138,9 +138,9 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
bt
=
self
.
portal
.
portal_templates
.
getInstalledBusinessTemplate
(
'erp5_core'
,
strict
=
True
)
for
path
,
obj
in
bt
.
_path_item
.
_objects
.
iteritems
():
path
,
obj_id
=
path
.
rsplit
(
'/'
,
1
)
if
path
==
'portal_ids'
:
id_tool
.
_setObject
(
obj_id
,
obj
.
_getCopy
(
bt
))
path
,
obj_id
=
path
.
rsplit
(
'/'
,
1
)
if
path
==
'portal_ids'
:
id_tool
.
_setObject
(
obj_id
,
obj
.
_getCopy
(
bt
))
self
.
tic
()
id_list
=
id_tool
.
generateNewLengthIdList
(
id_group
=
'foo'
)
# it is known that with current upgrade there is a hole
...
...
@@ -173,7 +173,7 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
def
_setUpLastMaxIdDict
(
self
,
id_generator_reference
):
def
countup
(
id_generator
,
id_group
,
until
):
for
i
in
xrange
(
until
+
1
):
for
_
in
xrange
(
until
+
1
):
self
.
id_tool
.
generateNewId
(
id_generator
=
id_generator_reference
,
id_group
=
id_group
)
...
...
@@ -251,14 +251,14 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
self
.
_setUpLastMaxIdDict
(
id_generator_reference
)
# test migration: PersistentMapping to OOBTree
self
.
assert
True
(
isinstance
(
last_id_dict
,
PersistentMapping
)
)
self
.
assert
IsInstance
(
last_id_dict
,
PersistentMapping
)
self
.
_assertIdGeneratorLastMaxIdDict
(
id_generator
)
id_generator
.
rebuildGeneratorIdDict
()
# migrate the dict
self
.
_assertIdGeneratorLastMaxIdDict
(
id_generator
)
# test migration: OOBTree to OOBTree. this changes nothing, just to be sure
last_id_dict
=
self
.
_getLastIdDict
(
id_generator
)
self
.
assert
True
(
isinstance
(
last_id_dict
,
OOBTree
)
)
self
.
assert
IsInstance
(
last_id_dict
,
OOBTree
)
self
.
_assertIdGeneratorLastMaxIdDict
(
id_generator
)
id_generator
.
rebuildGeneratorIdDict
()
# migrate the dict
self
.
_assertIdGeneratorLastMaxIdDict
(
id_generator
)
...
...
@@ -268,8 +268,8 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
'SQL Non Continuous Increasing Id Generator'
:
self
.
_setLastIdDict
(
id_generator
,
OOBTree
())
# set empty one
last_id_dict
=
self
.
_getLastIdDict
(
id_generator
)
assert
(
len
(
last_id_dict
),
0
)
# 0 because it is empty
self
.
assert
True
(
isinstance
(
last_id_dict
,
OOBTree
)
)
self
.
assertEqual
(
len
(
last_id_dict
),
0
)
# 0 because it is empty
self
.
assert
IsInstance
(
last_id_dict
,
OOBTree
)
# migrate the dict totally from sql table in this case
id_generator
.
rebuildGeneratorIdDict
()
self
.
_assertIdGeneratorLastMaxIdDict
(
id_generator
)
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIdToolUpgrade.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testIdToolUpgrade
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.tests.testIdToolUpgrade
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testIdToolUpgrade
</string>
</value>
...
...
@@ -37,13 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W:141, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W:142, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W:143, 0: Bad indentation. Found 12 spaces, expected 8 (bad-indentation)
</string>
<string>
W:176, 10: Unused variable \'i\' (unused-variable)
</string>
<string>
W:271, 6: Assert called on a 2-uple. Did you mean \'assert x,y\'? (assert-on-tuple)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -53,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -72,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -81,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testInteractionWorkflow.py
View file @
8d8066c9
...
...
@@ -35,6 +35,7 @@ from Products.ERP5Type.Base import _aq_reset
from
AccessControl
import
ClassSecurityInfo
from
Products.ERP5Type.Workflow
import
addWorkflowByType
class
TestInteractionWorkflow
(
ERP5TypeTestCase
):
portal_type
=
'Organisation'
...
...
@@ -78,11 +79,9 @@ class TestInteractionWorkflow(ERP5TypeTestCase):
return
addWorkflowByType
(
wf_tool
,
"interaction_workflow"
,
wf_id
)
def
createInteractionWorkflow
(
self
):
id
=
'test_workflow'
wf_type
=
"interaction_workflow"
if
getattr
(
self
.
getWorkflowTool
(),
id
,
None
)
is
None
:
self
.
_createInteractionWorkflowWithId
(
id
)
wf
=
self
.
getWorkflowTool
()[
id
]
if
getattr
(
self
.
getWorkflowTool
(),
'test_workflow'
,
None
)
is
None
:
self
.
_createInteractionWorkflowWithId
(
'test_workflow'
)
wf
=
self
.
getWorkflowTool
()[
'test_workflow'
]
self
.
wf
=
wf
if
getattr
(
wf
.
scripts
,
'afterEdit'
,
None
)
is
None
:
wf
.
scripts
.
manage_addProduct
[
'PythonScripts'
]
\
...
...
@@ -96,9 +95,7 @@ class TestInteractionWorkflow(ERP5TypeTestCase):
_aq_reset
()
# XXX Fails XXX _setLastId not found when doing newContent
def
createInteractionWorkflowWithTwoInteractions
(
self
):
id
=
'test_workflow'
wf_type
=
"interaction_workflow (Web-configurable interaction workflow)"
wf
=
self
.
_createInteractionWorkflowWithId
(
id
)
wf
=
self
.
_createInteractionWorkflowWithId
(
'test_workflow'
)
self
.
wf
=
wf
wf
.
scripts
.
manage_addProduct
[
'PythonScripts'
]
\
.
manage_addPythonScript
(
id
=
'afterEditA'
)
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testInteractionWorkflow.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testInteractionWorkflow
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.tests.testInteractionWorkflow
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testInteractionWorkflow
</string>
</value>
...
...
@@ -37,12 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 82, 4: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W: 83, 4: Unused variable \'wf_type\' (unused-variable)
</string>
<string>
W:100, 4: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:101, 4: Unused variable \'wf_type\' (unused-variable)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -52,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -71,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -80,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIntrospectionTool.py
View file @
8d8066c9
...
...
@@ -26,34 +26,14 @@
#
##############################################################################
import
unittest
from
AccessControl.SecurityManagement
import
newSecurityManager
import
json
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
import
json
class
TestIntrospectionTool
(
ERP5TypeTestCase
):
def
getBusinessTemplateList
(
self
):
""" """
return
(
'erp5_base'
,)
def
afterSetUp
(
self
):
self
.
portal
=
self
.
getPortal
()
self
.
login
()
def
login
(
self
):
uf
=
self
.
getPortal
().
acl_users
uf
.
_doAddUser
(
'seb'
,
''
,
[
'Manager'
],
[])
uf
.
_doAddUser
(
'ERP5TypeTestCase'
,
''
,
[
'Manager'
],
[])
user
=
uf
.
getUserById
(
'seb'
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
def
test_getSystemSignatureJSON
(
self
):
"""
Test
"""
signature_json
=
self
.
portal
.
portal_introspections
.
getSystemSignatureAsJSON
()
signature_by_json
=
json
.
loads
(
signature_json
)
signature
=
self
.
portal
.
portal_introspections
.
getSystemSignatureDict
()
...
...
@@ -62,7 +42,3 @@ class TestIntrospectionTool(ERP5TypeTestCase):
for
key
in
signature
:
self
.
assertEqual
(
signature
[
key
],
signature_by_json
[
key
])
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestIntrospectionTool
))
return
suite
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIntrospectionTool.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testIntrospectionTool
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.tests.testIntrospectionTool
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testIntrospectionTool
</string>
</value>
...
...
@@ -37,9 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 46, 2: Arguments number differs from overridden \'login\' method (arguments-differ)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -49,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -68,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -77,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testLocalizer.py
View file @
8d8066c9
...
...
@@ -150,7 +150,7 @@ class TestLocalizer(ERP5TypeTestCase):
{
'fr'
:
"C'est 1€."
,
'note'
:
''
,})
localizer
=
portal
.
Localizer
test_script
=
createZODBPythonScript
(
portal
.
portal_skins
.
custom
,
createZODBPythonScript
(
portal
.
portal_skins
.
custom
,
'test_script'
,
''
,
"""
def assertEquals(a, b):
if a != b:
...
...
@@ -191,7 +191,6 @@ assertEquals("This is 1€.", context.Base_translateString("This is 1€."))
value (e.g. the original message) must be returned
"""
message
=
" This is 1€ non-translated "
localizer
=
self
.
portal
.
Localizer
# Base_translateString == Localizer.translate() currently, which calls
# zope.i18n.translate and sets 'default' to 'message' before passing it to
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testLocalizer.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testLocalizer
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5Type.tests.testLocalizer
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testLocalizer
</string>
</value>
...
...
@@ -37,10 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W:153, 4: Unused variable \'test_script\' (unused-variable)
</string>
<string>
W:194, 4: Unused variable \'localizer\' (unused-variable)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -50,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -69,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -78,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testMemcachedTool.py
View file @
8d8066c9
...
...
@@ -74,11 +74,8 @@ class TestMemcachedTool(ERP5TypeTestCase):
self
.
tic
()
def
afterSetUp
(
self
):
self
.
login
()
def
login
(
self
):
uf
=
self
.
portal
.
acl_users
uf
.
_doAddUser
(
'vincent'
,
''
,
[
'Manager'
],
[])
uf
.
_doAddUser
(
'vincent'
,
self
.
newPassword
()
,
[
'Manager'
],
[])
user
=
uf
.
getUserById
(
'vincent'
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
...
...
@@ -104,6 +101,7 @@ class TestMemcachedTool(ERP5TypeTestCase):
memcached_tool
=
self
.
portal
.
portal_memcached
try
:
import
memcache
del
memcache
except
ImportError
:
# MemcachedTool should be disabled
self
.
assertRaises
(
RuntimeError
,
memcached_tool
.
getMemcachedDict
)
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testMemcachedTool.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testMemcachedTool
</string>
</value>
...
...
@@ -43,10 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 79, 2: Arguments number differs from overridden \'login\' method (arguments-differ)
</string>
<string>
W:106, 6: Unused variable \'memcache\' (unused-variable)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -56,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -75,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -84,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testNotificationMessageModule.py
View file @
8d8066c9
...
...
@@ -39,12 +39,9 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
def
getBusinessTemplateList
(
self
):
return
(
'erp5_base'
,)
def
createUser
(
self
,
name
,
role_list
):
self
.
portal
.
acl_users
.
_doAddUser
(
name
,
self
.
newPassword
(),
role_list
,
[])
def
afterSetUp
(
self
):
self
.
createUser
(
'erp5user'
,
[
'Auditor'
,
'Author'
])
self
.
createUser
(
'manager'
,
[
'Manager'
])
self
.
portal
.
acl_users
.
_doAddUser
(
'erp5user'
,
self
.
newPassword
(),
[
'Auditor'
,
'Author'
],
[
])
self
.
portal
.
acl_users
.
_doAddUser
(
'manager'
,
self
.
newPassword
(),
[
'Manager'
],
[
])
self
.
portal
.
email_from_address
=
'site@example.invalid'
self
.
loginByUserName
(
'erp5user'
)
...
...
@@ -130,7 +127,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
text_content_substitution_mapping_method_id
=
'NotificationMessage_getDummySubstitionMapping'
)
mime
,
text
=
doc
.
convert
(
'txt'
,
_
,
text
=
doc
.
convert
(
'txt'
,
substitution_method_parameter_dict
=
dict
(
a
=
'b'
))
self
.
assertEqual
(
'substitution text: b'
,
text
.
rstrip
())
...
...
@@ -148,7 +145,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
text_content_substitution_mapping_method_id
=
'NotificationMessage_getDummySubstitionMapping'
)
mime
,
text
=
doc
.
convert
(
'txt'
)
_
,
text
=
doc
.
convert
(
'txt'
)
self
.
assertEqual
(
'substitution text: b'
,
text
.
rstrip
())
def
test_safe_substitution_content
(
self
):
...
...
@@ -167,7 +164,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
text_content_substitution_mapping_method_id
=
'NotificationMessage_getDummySubstitionMapping'
)
mime
,
text
=
doc
.
convert
(
'txt'
)
_
,
text
=
doc
.
convert
(
'txt'
)
self
.
assertEqual
(
'substitution text: ${b}'
,
text
.
rstrip
())
self
.
assertEqual
(
'${b}'
,
doc
.
asSubjectText
())
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testNotificationMessageModule.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testNotificationMessageModule
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.tests.testNotificationMessageModule
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testNotificationMessageModule
</string>
</value>
...
...
@@ -37,12 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 49, 2: Arguments number differs from overridden \'createUser\' method (arguments-differ)
</string>
<string>
W:149, 4: Unused variable \'mime\' (unused-variable)
</string>
<string>
W:168, 4: Unused variable \'mime\' (unused-variable)
</string>
<string>
W:187, 4: Unused variable \'mime\' (unused-variable)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -52,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -71,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -80,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testNotificationTool.py
View file @
8d8066c9
...
...
@@ -38,7 +38,7 @@ from email.header import decode_header, make_header
from
email.utils
import
parseaddr
# Copied from ERP5Type/patches/CMFMailIn.py
def
decode_email
(
file
):
def
decode_email
(
file
_
):
# Prepare result
theMail
=
{
'attachment_list'
:
[],
...
...
@@ -47,9 +47,9 @@ def decode_email(file):
'headers'
:
{}
}
# Get Message
msg
=
email
.
message_from_string
(
file
)
msg
=
email
.
message_from_string
(
file
_
)
# Back up original file
theMail
[
'__original__'
]
=
file
theMail
[
'__original__'
]
=
file
_
# Recode headers to UTF-8 if needed
for
key
,
value
in
msg
.
items
():
decoded_value_list
=
decode_header
(
value
)
...
...
@@ -61,7 +61,7 @@ def decode_email(file):
'to'
,
'from'
,
'cc'
,
'sender'
,
'reply-to'
):
header_field
=
theMail
[
'headers'
].
get
(
header
)
if
header_field
:
theMail
[
'headers'
][
header
]
=
parseaddr
(
header_field
)[
1
]
theMail
[
'headers'
][
header
]
=
parseaddr
(
header_field
)[
1
]
# Get attachments
body_found
=
0
for
part
in
msg
.
walk
():
...
...
@@ -107,7 +107,7 @@ class TestNotificationTool(ERP5TypeTestCase):
def
getTitle
(
self
):
return
"Notification Tool"
def
createUser
(
self
,
name
,
role_list
):
def
createUser
(
self
,
name
,
role_list
):
# pylint:disable=arguments-differ
user_folder
=
self
.
getPortal
().
acl_users
user_folder
.
_doAddUser
(
name
,
'password'
,
role_list
,
[])
...
...
@@ -196,8 +196,8 @@ class TestNotificationTool(ERP5TypeTestCase):
self
.
portal
.
portal_notifications
.
sendMessage
(
recipient
=
sequence
[
'user_a_id'
],
subject
=
'Subject'
,
message
=
'Message'
)
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEqual
s
((),
last_message
)
mfrom
,
mto
,
messageText
=
last_message
self
.
assertNotEqual
(
last_message
,
()
)
mfrom
,
mto
,
_
=
last_message
self
.
assertEqual
(
'Portal Administrator <site@example.invalid>'
,
mfrom
)
self
.
assertEqual
([
'userA@example.invalid'
],
mto
)
...
...
@@ -236,8 +236,8 @@ class TestNotificationTool(ERP5TypeTestCase):
self
.
portal
.
portal_notifications
.
sendMessage
(
subject
=
'Subject'
,
message
=
'Message'
)
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEqual
s
((),
last_message
)
mfrom
,
mto
,
messageText
=
last_message
self
.
assertNotEqual
(
last_message
,
()
)
mfrom
,
mto
,
_
=
last_message
self
.
assertEqual
(
'Portal Administrator <site@example.invalid>'
,
mfrom
)
self
.
assertEqual
([
'site@example.invalid'
],
mto
)
...
...
@@ -249,8 +249,8 @@ class TestNotificationTool(ERP5TypeTestCase):
self
.
portal
.
portal_notifications
.
sendMessage
(
recipient
=
sequence
[
'user_a_id'
],
subject
=
'Subject'
,
)
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEqual
s
((),
last_message
)
mfrom
,
mto
,
messageText
=
last_message
self
.
assertNotEqual
(
last_message
,
()
)
mfrom
,
mto
,
_
=
last_message
self
.
assertEqual
(
'Portal Administrator <site@example.invalid>'
,
mfrom
)
self
.
assertEqual
([
'userA@example.invalid'
],
mto
)
...
...
@@ -272,7 +272,7 @@ class TestNotificationTool(ERP5TypeTestCase):
self
.
portal
.
portal_notifications
.
sendMessage
(
recipient
=
sequence
[
'user_a_id'
],
subject
=
'Subject'
,
message
=
'Message'
)
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEqual
s
((),
last_message
)
self
.
assertNotEqual
(
last_message
,
()
)
mfrom
,
mto
,
messageText
=
last_message
self
.
assertEqual
(
'Portal Administrator <site@example.invalid>'
,
mfrom
)
self
.
assertEqual
([
'userA@example.invalid'
],
mto
)
...
...
@@ -313,7 +313,7 @@ class TestNotificationTool(ERP5TypeTestCase):
])
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEqual
s
((),
last_message
)
self
.
assertNotEqual
(
last_message
,
()
)
mfrom
,
mto
,
messageText
=
last_message
self
.
assertEqual
(
'Portal Administrator <site@example.invalid>'
,
mfrom
)
self
.
assertEqual
([
'userA@example.invalid'
],
mto
)
...
...
@@ -345,14 +345,14 @@ class TestNotificationTool(ERP5TypeTestCase):
recipient
=
[
sequence
[
'user_a_id'
],
sequence
[
'user_b_id'
]],
subject
=
'Subject'
,
message
=
'Message'
)
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEqual
s
((),
last_message
)
mfrom
,
mto
,
messageText
=
last_message
self
.
assertNotEqual
(
last_message
,
()
)
mfrom
,
mto
,
_
=
last_message
self
.
assertEqual
(
'Portal Administrator <site@example.invalid>'
,
mfrom
)
self
.
assertEqual
([
'userB@example.invalid'
],
mto
)
previous_message
=
self
.
portal
.
MailHost
.
_previous_message
self
.
assertNotEqual
s
((),
previous_message
)
mfrom
,
mto
,
messageText
=
previous_message
self
.
assertNotEqual
(
last_message
,
()
)
mfrom
,
mto
,
_
=
previous_message
self
.
assertEqual
(
'Portal Administrator <site@example.invalid>'
,
mfrom
)
self
.
assertEqual
([
'userA@example.invalid'
],
mto
)
...
...
@@ -400,7 +400,7 @@ class TestNotificationTool(ERP5TypeTestCase):
self
.
portal
.
portal_notifications
.
sendMessage
(
recipient
=
person
.
getObject
(),
subject
=
'Subject'
,
message
=
'Message'
)
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEqual
s
((),
last_message
)
self
.
assertNotEqual
(
last_message
,
()
)
mfrom
,
mto
,
messageText
=
last_message
self
.
assertEqual
(
'Portal Administrator <site@example.invalid>'
,
mfrom
)
self
.
assertEqual
([
'userA@example.invalid'
],
mto
)
...
...
@@ -434,7 +434,7 @@ Yes, I will go."""
recipient
=
sequence
[
'user_a_id'
],
subject
=
'Subject'
,
message_text_format
=
'text/plain'
,
message
=
message
)
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEqual
s
((),
last_message
)
self
.
assertNotEqual
(
last_message
,
()
)
mfrom
,
mto
,
messageText
=
last_message
self
.
assertEqual
(
'Portal Administrator <site@example.invalid>'
,
mfrom
)
self
.
assertEqual
([
'userA@example.invalid'
],
mto
)
...
...
@@ -493,7 +493,7 @@ Yes, I will go."""
self
.
portal
.
portal_notifications
.
sendMessage
(
recipient
=
sequence
[
'user_a_id'
],
subject
=
'Subject'
,
message
=
'Message'
)
last_message
=
self
.
portal
.
MailHost
.
_last_message
self
.
assertNotEqual
s
((),
last_message
)
self
.
assertNotEqual
(
last_message
,
()
)
def
test_permission_on_recipient_not_needed
(
self
):
"""Notification Tool can be used to send Messages even when user does not
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testNotificationTool.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testNotificationTool
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.tests.testNotificationTool
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testNotificationTool
</string>
</value>
...
...
@@ -37,15 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 64, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 41, 17: Redefining built-in \'file\' (redefined-builtin)
</string>
<string>
W:110, 2: Arguments number differs from overridden \'createUser\' method (arguments-differ)
</string>
<string>
W:200, 16: Unused variable \'messageText\' (unused-variable)
</string>
<string>
W:240, 16: Unused variable \'messageText\' (unused-variable)
</string>
<string>
W:253, 16: Unused variable \'messageText\' (unused-variable)
</string>
<string>
W:349, 16: Unused variable \'messageText\' (unused-variable)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -55,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -74,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -83,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testSessionTool.py
View file @
8d8066c9
...
...
@@ -29,7 +29,6 @@
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
AccessControl.SecurityManagement
import
newSecurityManager
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
erp5.component.tool.SessionTool
import
SESSION_CACHE_FACTORY
from
string
import
letters
as
LETTERS
...
...
@@ -47,27 +46,6 @@ class TestSessionTool(ERP5TypeTestCase):
session_id
=
"123456789"
def
getTitle
(
self
):
return
"Session Tool"
def
afterSetUp
(
self
):
# create a Memcached Plugin
memcached_tool
=
self
.
portal
.
portal_memcached
#create Memcache Plugin
if
getattr
(
memcached_tool
,
'default_memcached_plugin'
,
None
)
is
None
:
memcached_tool
.
newContent
(
id
=
'default_memcached_plugin'
,
portal_type
=
'Memcached Plugin'
,
int_index
=
0
,
url_string
=
'127.0.0.1:11211'
)
self
.
login
()
def
login
(
self
):
uf
=
self
.
portal
.
acl_users
uf
.
_doAddUser
(
'ivan'
,
''
,
[
'Manager'
],
[])
uf
.
_doAddUser
(
'ERP5TypeTestCase'
,
''
,
[
'Manager'
],
[])
user
=
uf
.
getUserById
(
'ivan'
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
def
_changeCachePlugin
(
self
,
portal_type
,
storage_duration
=
86400
):
""" Change current cache plugin with new one. """
portal_caches
=
self
.
portal
.
portal_caches
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testSessionTool.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSessionTool
</string>
</value>
...
...
@@ -43,9 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 70, 2: Arguments number differs from overridden \'login\' method (arguments-differ)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -55,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -74,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -83,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTimeout.py
View file @
8d8066c9
...
...
@@ -75,4 +75,4 @@ class TestTimeout(ERP5TypeTestCase):
with
Deadline
(
1.0
):
time
.
sleep
(
2
)
with
self
.
assertRaises
(
TimeoutReachedError
):
[
x
.
getObject
()
for
x
in
self
.
portal
.
portal_templates
.
searchFolder
()]
_
=
[
x
.
getObject
()
for
x
in
self
.
portal
.
portal_templates
.
searchFolder
()]
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTimeout.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testTimeout
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5Type.tests.testTimeout
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testTimeout
</string>
</value>
...
...
@@ -37,9 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 78, 8: Expression "[x.getObject() for x in self.portal.portal_templates.searchFolder()]" is assigned to nothing (expression-not-assigned)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -49,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -68,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -77,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTimerService.py
View file @
8d8066c9
...
...
@@ -26,14 +26,12 @@
#
##############################################################################
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
AccessControl.SecurityManagement
import
newSecurityManager
,
\
noSecurityManager
from
AccessControl.SecurityManagement
import
noSecurityManager
from
AccessControl.ZopeGuards
import
guarded_apply
,
guarded_getattr
from
zExceptions
import
Unauthorized
class
TestTimerService
(
ERP5TypeTestCase
):
"""
Test TimerService-related features. Maybe this should be put in TimerService
...
...
@@ -41,20 +39,6 @@ class TestTimerService(ERP5TypeTestCase):
idea to put an ERP5-type test in it.
"""
def
getTitle
(
self
):
return
"TimerService"
def
getBusinessTemplateList
(
self
):
"""
"""
return
()
def
afterSetUp
(
self
):
uf
=
self
.
portal
.
acl_users
uf
.
_doAddUser
(
'rc'
,
''
,
[
'Manager'
],
[])
user
=
uf
.
getUserById
(
'rc'
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
def
test_01_checkAnonymousProcessing
(
self
):
"""
Test whether a timer can be invoked by anonymous.
...
...
@@ -63,14 +47,9 @@ class TestTimerService(ERP5TypeTestCase):
timer_service
=
self
.
app
.
Control_Panel
.
timer_service
process_timer
=
guarded_getattr
(
timer_service
,
'process_timer'
)
try
:
guarded_apply
(
process_timer
,
(
0
,))
guarded_apply
(
process_timer
,
(
0
,))
except
Unauthorized
:
self
.
fail
(
'calling process_timer is unauthorized'
)
except
:
# Do not care about any exception but unauthorized.
pass
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestTimerService
))
return
suite
self
.
fail
(
'calling process_timer is unauthorized'
)
except
Exception
:
# Do not care about any exception but unauthorized.
pass
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTimerService.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testTimerService
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5Type.tests.testTimerService
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testTimerService
</string>
</value>
...
...
@@ -37,12 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 66, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 68, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 71, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 69, 4: No exception type(s) specified (bare-except)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -52,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -71,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -80,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTransactionalVariable.py
View file @
8d8066c9
...
...
@@ -31,74 +31,74 @@ from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
class
TestTransactionalVariable
(
TestCase
):
from
transaction
import
abort
,
commit
from
transaction
import
abort
,
commit
def
test_01_DictInterface
(
self
):
"""Check if a transaction variable behaves in the same way as a dict. """
def
test_01_DictInterface
(
self
):
"""Check if a transaction variable behaves in the same way as a dict. """
tv
=
getTransactionalVariable
()
tv
=
getTransactionalVariable
()
# Test frequently used dict methods. This does not cover everything,
# but should be enough.
tv
.
clear
()
self
.
assertEqual
(
len
(
tv
),
0
)
with
self
.
assertRaises
(
KeyError
):
tv
[
'toto'
]
# Test frequently used dict methods. This does not cover everything,
# but should be enough.
tv
.
clear
()
self
.
assertEqual
(
len
(
tv
),
0
)
with
self
.
assertRaises
(
KeyError
):
_
=
tv
[
'toto'
]
tv
[
'toto'
]
=
'titi'
self
.
assertEqual
(
len
(
tv
),
1
)
self
.
assertEqual
(
tv
[
'toto'
],
'titi'
)
tv
[
'toto'
]
=
'titi'
self
.
assertEqual
(
len
(
tv
),
1
)
self
.
assertEqual
(
tv
[
'toto'
],
'titi'
)
self
.
assertIsNone
(
tv
.
get
(
'foo'
))
tv
.
setdefault
(
'foo'
,
'bar'
)
self
.
assertEqual
(
len
(
tv
),
2
)
self
.
assertEqual
(
tv
[
'foo'
],
'bar'
)
self
.
assertIsNone
(
tv
.
get
(
'foo'
))
tv
.
setdefault
(
'foo'
,
'bar'
)
self
.
assertEqual
(
len
(
tv
),
2
)
self
.
assertEqual
(
tv
[
'foo'
],
'bar'
)
self
.
assertIn
(
'foo'
,
tv
)
del
tv
[
'foo'
]
self
.
assertNotIn
(
'foo'
,
tv
)
self
.
assertEqual
(
len
(
tv
),
1
)
self
.
assertIn
(
'foo'
,
tv
)
del
tv
[
'foo'
]
self
.
assertNotIn
(
'foo'
,
tv
)
self
.
assertEqual
(
len
(
tv
),
1
)
def
test_02_Expiration
(
self
):
"""Check if a transaction variable does not persist over multiple
transactions.
"""
tv
=
getTransactionalVariable
()
tv
.
clear
()
self
.
assertEqual
(
len
(
tv
),
0
)
def
test_02_Expiration
(
self
):
"""Check if a transaction variable does not persist over multiple
transactions.
"""
tv
=
getTransactionalVariable
()
tv
.
clear
()
self
.
assertEqual
(
len
(
tv
),
0
)
# Commit and check.
tv
[
'toto'
]
=
'titi'
self
.
assertEqual
(
tv
[
'toto'
],
'titi'
)
self
.
commit
()
self
.
assertNotIn
(
'toto'
,
tv
)
# Commit and check.
tv
[
'toto'
]
=
'titi'
self
.
assertEqual
(
tv
[
'toto'
],
'titi'
)
self
.
commit
()
self
.
assertNotIn
(
'toto'
,
tv
)
# Abort and check.
tv
[
'toto'
]
=
'titi'
self
.
assertEqual
(
tv
[
'toto'
],
'titi'
)
self
.
abort
()
self
.
assertNotIn
(
'toto'
,
tv
)
# Abort and check.
tv
[
'toto'
]
=
'titi'
self
.
assertEqual
(
tv
[
'toto'
],
'titi'
)
self
.
abort
()
self
.
assertNotIn
(
'toto'
,
tv
)
def
test_03_Durability
(
self
):
"""Check if a transaction variable does not disappear within the same
transaction.
"""
tv
=
getTransactionalVariable
()
tv
.
clear
()
self
.
assertEqual
(
len
(
tv
),
0
)
def
test_03_Durability
(
self
):
"""Check if a transaction variable does not disappear within the same
transaction.
"""
tv
=
getTransactionalVariable
()
tv
.
clear
()
self
.
assertEqual
(
len
(
tv
),
0
)
# Set both a transaction variable and a volatile attribute,
# in order to detect the difference between their behaviors.
tv
[
'toto'
]
=
'titi'
self
.
assertEqual
(
tv
[
'toto'
],
'titi'
)
app
=
self
.
app
vattr
=
'_v_erp5type_test_durability'
setattr
(
app
,
vattr
,
'dummy'
)
self
.
assertEqual
(
getattr
(
app
,
vattr
),
'dummy'
)
# Set both a transaction variable and a volatile attribute,
# in order to detect the difference between their behaviors.
tv
[
'toto'
]
=
'titi'
self
.
assertEqual
(
tv
[
'toto'
],
'titi'
)
app
=
self
.
app
vattr
=
'_v_erp5type_test_durability'
setattr
(
app
,
vattr
,
'dummy'
)
self
.
assertEqual
(
getattr
(
app
,
vattr
),
'dummy'
)
# Force to minimize the connection cache so that volatile attributes
# and unghostified objects are discarded.
app
.
_p_jar
.
cacheMinimize
()
self
.
assertIn
(
'toto'
,
tv
)
self
.
assertEqual
(
tv
[
'toto'
],
'titi'
)
self
.
assertIsNone
(
getattr
(
app
,
vattr
,
None
))
# Force to minimize the connection cache so that volatile attributes
# and unghostified objects are discarded.
app
.
_p_jar
.
cacheMinimize
()
self
.
assertIn
(
'toto'
,
tv
)
self
.
assertEqual
(
tv
[
'toto'
],
'titi'
)
self
.
assertIsNone
(
getattr
(
app
,
vattr
,
None
))
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTransactionalVariable.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testTransactionalVariable
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5Type.tests.testTransactionalVariable
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testTransactionalVariable
</string>
</value>
...
...
@@ -37,56 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 34, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 36, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 37, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 39, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 43, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 44, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 45, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 46, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 48, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 49, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 50, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 52, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 53, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 54, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 55, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 57, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 58, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 59, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 60, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 62, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 63, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 66, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 67, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 68, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 71, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 72, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 73, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 74, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 77, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 78, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 79, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 80, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 82, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)
</string>
<string>
W: 83, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 86, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 87, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 88, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 92, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 93, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 94, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 95, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 96, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 97, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:101, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:102, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:103, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W:104, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)
</string>
<string>
W: 46, 8: Statement seems to have no effect (pointless-statement)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -96,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -115,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -124,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTrashTool.py
View file @
8d8066c9
...
...
@@ -53,13 +53,8 @@ class TestTrashTool(ERP5TypeTestCase):
return
1
def
afterSetUp
(
self
):
self
.
login
()
portal
=
self
.
getPortal
()
catalog_tool
=
self
.
getCatalogTool
()
def
login
(
self
):
uf
=
self
.
getPortal
().
acl_users
uf
.
_doAddUser
(
'seb'
,
''
,
[
'Manager'
],
[])
uf
=
self
.
portal
.
acl_users
uf
.
_doAddUser
(
'seb'
,
self
.
newPassword
(),
[
'Manager'
],
[])
user
=
uf
.
getUserById
(
'seb'
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
...
...
@@ -81,9 +76,8 @@ class TestTrashTool(ERP5TypeTestCase):
base_category
=
pc
.
_getOb
(
bc_id
,
None
)
self
.
assertTrue
(
base_category
is
not
None
)
category_list
=
[]
for
i
in
xrange
(
10
):
for
_
in
xrange
(
10
):
category
=
base_category
.
newContent
(
portal_type
=
'Category'
)
self
.
assertTrue
(
category
is
not
None
)
category_list
.
append
(
category
.
getId
())
sequence
.
edit
(
category_id_list
=
category_list
)
...
...
@@ -95,13 +89,13 @@ class TestTrashTool(ERP5TypeTestCase):
erp5_core
=
ps
[
'erp5_core'
]
erp5_core
.
manage_addFolder
(
id
=
"image"
)
image
=
erp5_core
.
_getOb
(
"image"
)
f
=
image
.
manage_addFile
(
id
=
"file"
)
image
.
manage_addFile
(
id
=
"file"
)
def
stepCheckTrashToolExists
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Check existence of trash tool
"""
self
.
assert
True
(
self
.
getTrashTool
()
is
not
None
)
self
.
assert
IsNotNone
(
self
.
getTrashTool
()
)
def
stepCreateTrashBin
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
...
...
@@ -193,11 +187,10 @@ class TestTrashTool(ERP5TypeTestCase):
trash_id
=
sequence
.
get
(
'trash_id'
)
trash
=
self
.
getTrashTool
()
trashbin
=
trash
.
_getOb
(
trash_id
,
None
)
self
.
assert
True
(
trashbin
is
not
None
)
self
.
assert
IsNotNone
(
trashbin
)
# get category trash folder
bc_id
=
sequence
.
get
(
'bc_id'
)
trashbin_objects_list
=
list
(
trashbin
.
objectValues
())
self
.
assertTrue
(
len
(
trashbin_objects_list
)
>
0
)
self
.
assertEqual
(
len
(
trashbin_objects_list
),
1
)
obj
=
trashbin_objects_list
[
0
]
self
.
assertEqual
(
obj
.
getId
(),
'portal_categories_items'
)
...
...
@@ -215,11 +208,10 @@ class TestTrashTool(ERP5TypeTestCase):
subcat_objects_list
=
(
cat_object
.
objectIds
())
self
.
assertNotEqual
(
len
(
subcat_objects_list
),
0
)
categ_id_list
=
sequence
.
get
(
'category_id_list'
)
for
id
in
subcat_objects_list
:
self
.
assertTrue
(
id
in
categ_id_list
)
cat
=
cat_object
.
_getOb
(
id
,
None
)
self
.
assertTrue
(
cat
is
not
None
)
self
.
assertTrue
(
cat
.
isIndexable
,
0
)
for
id_
in
subcat_objects_list
:
self
.
assertIn
(
id_
,
categ_id_list
)
cat
=
cat_object
.
_getOb
(
id_
,
None
)
self
.
assertTrue
(
cat
.
isIndexable
)
self
.
assertEqual
(
cat
.
getPortalType
(),
'Category'
)
def
stepCheckFolderObjectBackup
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
...
@@ -230,7 +222,6 @@ class TestTrashTool(ERP5TypeTestCase):
trash
=
self
.
getTrashTool
()
trashbin
=
trash
.
_getOb
(
trash_id
,
None
)
self
.
assertTrue
(
trashbin
is
not
None
)
bc_id
=
sequence
.
get
(
'bc_id'
)
trashbin_objects_list
=
list
(
trashbin
.
objectValues
())
self
.
assertTrue
(
len
(
trashbin_objects_list
)
>
0
)
self
.
assertEqual
(
len
(
trashbin_objects_list
),
1
)
...
...
@@ -318,8 +309,6 @@ class TestTrashTool(ERP5TypeTestCase):
bc_id
=
sequence
.
get
(
'bc_id'
)
pc
=
self
.
getCategoryTool
()
base_category
=
pc
.
_getOb
(
bc_id
,
None
)
self
.
assertTrue
(
base_category
is
not
None
)
subobjects_ids
=
base_category
.
objectIds
()
bc_path
=
base_category
.
getPath
().
split
(
'/'
)[
2
:
-
1
]
# check backup
backup_subobjects_ids
=
trash
.
backupObject
(
trashbin
,
bc_path
,
bc_id
,
save
=
1
,
keep_subobjects
=
1
)
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTrashTool.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testTrashTool
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.tests.testTrashTool
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testTrashTool
</string>
</value>
...
...
@@ -37,16 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 57, 4: Unused variable \'portal\' (unused-variable)
</string>
<string>
W: 58, 4: Unused variable \'catalog_tool\' (unused-variable)
</string>
<string>
W: 60, 2: Arguments number differs from overridden \'login\' method (arguments-differ)
</string>
<string>
W: 84, 8: Unused variable \'i\' (unused-variable)
</string>
<string>
W: 98, 4: Unused variable \'f\' (unused-variable)
</string>
<string>
W:218, 8: Redefining built-in \'id\' (redefined-builtin)
</string>
<string>
W:233, 4: Unused variable \'bc_id\' (unused-variable)
</string>
<string>
W:322, 4: Unused variable \'subobjects_ids\' (unused-variable)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -56,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -75,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -84,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWorkflowHistoryList.py
View file @
8d8066c9
...
...
@@ -94,7 +94,7 @@ class TestWorkflowHistoryList(TestCase):
a
=
EXPECTED
[
item
]
except
IndexError
:
with
self
.
assertRaises
(
IndexError
):
ddl
[
item
]
_
=
ddl
[
item
]
else
:
assert
a
!=
[],
a
self
.
assertEqual
(
a
,
ddl
[
item
])
...
...
@@ -102,16 +102,16 @@ class TestWorkflowHistoryList(TestCase):
i
=
COUNT
+
1
for
i
in
xrange
(
-
i
,
i
):
check
[
i
]
check
[
-
50
:
10
]
check
[:
20
:
3
]
check
[
5
:
40
]
check
[
32
::
4
]
check
[::
-
1
]
check
[
-
5
::
-
7
]
check
[
50
:
40
:
-
1
]
check
[
30
:
-
50
:
-
4
]
check
[:
30
:
-
3
]
_
=
check
[
i
]
_
=
check
[
-
50
:
10
]
_
=
check
[:
20
:
3
]
_
=
check
[
5
:
40
]
_
=
check
[
32
::
4
]
_
=
check
[::
-
1
]
_
=
check
[
-
5
::
-
7
]
_
=
check
[
50
:
40
:
-
1
]
_
=
check
[
30
:
-
50
:
-
4
]
_
=
check
[:
30
:
-
3
]
self
.
assertFalse
(
ddl
[
-
5
:
30
])
self
.
assertFalse
(
ddl
[
30
:
-
5
:
-
1
])
...
...
@@ -129,8 +129,7 @@ class TestWorkflowHistoryList(TestCase):
@
fixed_count_bucket
def
test_01_DoublyLinkList
(
self
):
EXPECTED
=
range
(
COUNT
)
self
.
checkList
(
new
(
DoublyLinkList
,
EXPECTED
))
self
.
checkList
(
new
(
DoublyLinkList
,
range
(
COUNT
)))
@
fixed_count_bucket
def
test_02_LegacyWorkflowHistoryList
(
self
):
...
...
@@ -205,10 +204,10 @@ class TestDedup(ERP5TypeTestCase):
self
.
login
()
deduped
=
[]
def
dedupStrings
(
obj
):
new
=
orig_dedupStrings
(
obj
)
self
.
assertEqual
(
new
,
obj
)
deduped
.
append
(
len
(
new
))
return
new
new
_obj
=
orig_dedupStrings
(
obj
)
self
.
assertEqual
(
new
_obj
,
obj
)
deduped
.
append
(
len
(
new
_obj
))
return
new
_obj
from
Products.ERP5Type
import
Workflow
orig_dedupStrings
=
Workflow
.
dedupStrings
try
:
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWorkflowHistoryList.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testWorkflowHistoryList
</string>
</value>
...
...
@@ -43,21 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 97, 12: Statement seems to have no effect (pointless-statement)
</string>
<string>
W:105, 6: Statement seems to have no effect (pointless-statement)
</string>
<string>
W:106, 4: Statement seems to have no effect (pointless-statement)
</string>
<string>
W:107, 4: Statement seems to have no effect (pointless-statement)
</string>
<string>
W:108, 4: Statement seems to have no effect (pointless-statement)
</string>
<string>
W:109, 4: Statement seems to have no effect (pointless-statement)
</string>
<string>
W:110, 4: Statement seems to have no effect (pointless-statement)
</string>
<string>
W:111, 4: Statement seems to have no effect (pointless-statement)
</string>
<string>
W:112, 4: Statement seems to have no effect (pointless-statement)
</string>
<string>
W:113, 4: Statement seems to have no effect (pointless-statement)
</string>
<string>
W:114, 4: Statement seems to have no effect (pointless-statement)
</string>
<string>
W:132, 4: Redefining name \'EXPECTED\' from outer scope (line 76) (redefined-outer-name)
</string>
<string>
W:206, 6: Redefining name \'new\' from outer scope (line 55) (redefined-outer-name)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -67,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -86,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -95,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testXMLPickle.py
View file @
8d8066c9
...
...
@@ -78,7 +78,7 @@ class TestXMLPickle(unittest.TestCase):
reconstructed_obj
=
pickle
.
loads
(
reconstructed_pickled_data
)
self
.
assert_
(
reconstructed_obj
.
__class__
is
DummyClass
)
self
.
assert_
(
type
(
getattr
(
reconstructed_obj
,
'data'
,
None
))
is
list
)
self
.
assert_
(
type
(
getattr
(
reconstructed_obj
,
'data'
,
None
))
is
list
)
# pylint:disable=unidiomatic-typecheck
self
.
assertEqual
(
reconstructed_obj
.
data
[
0
],
1
)
self
.
assert_
(
reconstructed_obj
.
data
[
1
]
is
reconstructed_obj
)
self
.
assert_
(
reconstructed_obj
.
data
[
2
]
is
reconstructed_obj
.
data
)
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testXMLPickle.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testXMLPickle
</string>
</value>
...
...
@@ -43,9 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 81, 17: Using type() instead of isinstance() for a typecheck. (unidiomatic-typecheck)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -55,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -74,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -83,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testZODBHistory.py
View file @
8d8066c9
...
...
@@ -58,7 +58,7 @@ class TestZODBHistory(ERP5TypeTestCase):
preference
=
preference_tool
.
newContent
(
id
=
"zodb_history_test_preference"
,
portal_type
=
"Preference"
)
if
preference
.
getPreferenceState
()
!=
"enabled"
:
preference
.
enable
()
preference
.
enable
()
def
addOrganisation
(
self
,
organisation_id
):
""" Add an organisation """
...
...
@@ -69,19 +69,9 @@ class TestZODBHistory(ERP5TypeTestCase):
def
setUpUser
(
self
):
""" Set up a user to test normal users can use this function. """
self
.
addUser
(
'tatuya'
)
def
addUser
(
self
,
user_name
,
role
=
[
'Member'
,
'Owner'
,
'Assignor'
]):
""" Create a test user."""
uf
=
self
.
portal
.
acl_users
if
not
uf
.
getUserById
(
user_name
):
uf
.
_doAddUser
(
user_name
,
''
,
role
,
[])
def
_clearCache
(
self
):
""" Clear cache to validate the preference modification. """
self
.
portal
.
portal_caches
.
clearCache
(
cache_factory_list
=
(
'erp5_ui_short'
,
# for preference cache
))
if
not
uf
.
getUserById
(
'tatuya'
):
uf
.
_doAddUser
(
'tatuya'
,
''
,
[
'Member'
,
'Owner'
,
'Assignor'
],
[])
def
test_01_testZODBHistory
(
self
):
"""
...
...
@@ -116,7 +106,6 @@ class TestZODBHistory(ERP5TypeTestCase):
# changes the limit to 100
preference
.
setPreferredHtmlStyleZodbHistorySize
(
100
)
self
.
_clearCache
()
self
.
assertEqual
(
preference
.
getPreferredHtmlStyleZodbHistorySize
(),
100
)
history_list
=
org2
.
Base_getZODBHistoryList
()
# Now that the limit is 100, thus the history page show the all history
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testZODBHistory.xml
View file @
8d8066c9
...
...
@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testZODBHistory
</string>
</value>
...
...
@@ -14,6 +20,12 @@
<key>
<string>
default_source_reference
</string>
</key>
<value>
<string>
Products.ERP5.tests.testZODBHistory
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testZODBHistory
</string>
</value>
...
...
@@ -37,10 +49,7 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 61, 0: Bad indentation. Found 7 spaces, expected 6 (bad-indentation)
</string>
<string>
W: 74, 2: Dangerous default value [] as argument (dangerous-default-value)
</string>
</tuple>
<tuple/>
</value>
</item>
<item>
...
...
@@ -50,13 +59,28 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -69,7 +93,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -78,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment