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