Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Iliya Manolov
erp5
Commits
ee36705f
Commit
ee36705f
authored
Nov 11, 2011
by
Tatuya Kamada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Follow the security fix at
f3dfe80b
.
parent
73b29ecc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
product/ERP5/tests/testTemplate.py
product/ERP5/tests/testTemplate.py
+11
-7
No files found.
product/ERP5/tests/testTemplate.py
View file @
ee36705f
...
@@ -49,10 +49,12 @@ class TestTemplate(ERP5TypeTestCase):
...
@@ -49,10 +49,12 @@ class TestTemplate(ERP5TypeTestCase):
"""Returns list of BT to be installed."""
"""Returns list of BT to be installed."""
return
(
'erp5_base'
,
'erp5_knowledge_pad'
,
'erp5_ui_test'
)
return
(
'erp5_base'
,
'erp5_knowledge_pad'
,
'erp5_ui_test'
)
def
createUserAndLogin
(
self
,
name
=
None
):
def
createUserAndLogin
(
self
,
name
=
None
,
additional_role_list
=
[]
):
"""login with Member
& Author
roles."""
"""login with Member
, Author and specified
roles."""
uf
=
self
.
getPortal
().
acl_users
uf
=
self
.
getPortal
().
acl_users
uf
.
_doAddUser
(
name
,
''
,
[
'Member'
,
'Author'
],
[])
role_list
=
[
'Member'
,
'Author'
]
role_list
.
extend
(
additional_role_list
)
uf
.
_doAddUser
(
name
,
''
,
role_list
,
[])
user
=
uf
.
getUserById
(
name
).
__of__
(
uf
)
user
=
uf
.
getUserById
(
name
).
__of__
(
uf
)
newSecurityManager
(
None
,
user
)
newSecurityManager
(
None
,
user
)
...
@@ -367,12 +369,12 @@ class TestTemplate(ERP5TypeTestCase):
...
@@ -367,12 +369,12 @@ class TestTemplate(ERP5TypeTestCase):
self
.
assertEquals
(
'enabled'
,
preference
.
getPreferenceState
())
self
.
assertEquals
(
'enabled'
,
preference
.
getPreferenceState
())
self
.
assertEqual
(
len
(
preference
.
objectIds
()),
2
)
self
.
assertEqual
(
len
(
preference
.
objectIds
()),
2
)
def
_testTemplateNotIndexable
(
self
,
document
):
def
_testTemplateNotIndexable
(
self
,
document
,
additional_role_list
=
[]
):
# template documents are not indexable
# template documents are not indexable
self
.
portal
.
portal_activities
.
manage_enableActivityTracking
()
self
.
portal
.
portal_activities
.
manage_enableActivityTracking
()
self
.
portal
.
portal_activities
.
manage_enableActivityTimingLogging
()
self
.
portal
.
portal_activities
.
manage_enableActivityTimingLogging
()
self
.
portal
.
portal_activities
.
manage_enableActivityCreationTrace
()
self
.
portal
.
portal_activities
.
manage_enableActivityCreationTrace
()
self
.
createUserAndLogin
(
self
.
id
())
self
.
createUserAndLogin
(
self
.
id
()
,
additional_role_list
=
additional_role_list
)
preference
=
self
.
portal
.
portal_preferences
.
newContent
(
portal_type
=
'Preference'
)
preference
=
self
.
portal
.
portal_preferences
.
newContent
(
portal_type
=
'Preference'
)
preference
.
priority
=
Priority
.
USER
preference
.
priority
=
Priority
.
USER
preference
.
enable
()
preference
.
enable
()
...
@@ -392,7 +394,7 @@ class TestTemplate(ERP5TypeTestCase):
...
@@ -392,7 +394,7 @@ class TestTemplate(ERP5TypeTestCase):
self
.
assertEqual
(
len
(
preference
.
objectIds
()),
1
)
self
.
assertEqual
(
len
(
preference
.
objectIds
()),
1
)
template
=
preference
.
objectValues
()[
0
]
template
=
preference
.
objectValues
()[
0
]
self
.
assertFalse
(
template
.
isIndexable
)
self
.
assertFalse
(
template
.
isIndexable
)
# Because they are not indexable, they cannot be found by catalog
# Because they are not indexable, they cannot be found by catalog
self
.
assertEquals
(
0
,
len
(
self
.
portal
.
portal_catalog
(
uid
=
template
.
getUid
())))
self
.
assertEquals
(
0
,
len
(
self
.
portal
.
portal_catalog
(
uid
=
template
.
getUid
())))
template_line
=
template
.
objectValues
()[
0
]
template_line
=
template
.
objectValues
()[
0
]
...
@@ -428,7 +430,9 @@ class TestTemplate(ERP5TypeTestCase):
...
@@ -428,7 +430,9 @@ class TestTemplate(ERP5TypeTestCase):
document
.
newContent
(
portal_type
=
'Knowledge Box'
)
document
.
newContent
(
portal_type
=
'Knowledge Box'
)
transaction
.
commit
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
self
.
_testTemplateNotIndexable
(
document
)
# Only Manager can Copy and Move at Knowlede Pad Document when it is
# 'invisible' state.
self
.
_testTemplateNotIndexable
(
document
,
additional_role_list
=
[
'Manager'
])
def
test_suite
():
def
test_suite
():
...
...
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