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
1
Issues
1
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
Roque
erp5
Commits
c9d46da7
Commit
c9d46da7
authored
Feb 03, 2025
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_discussion: update tests
parent
a77bff2f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
40 deletions
+40
-40
bt5/erp5_discussion/TestTemplateItem/portal_components/test.erp5.testERP5Discussion.py
...ateItem/portal_components/test.erp5.testERP5Discussion.py
+34
-15
bt5/erp5_discussion/TestTemplateItem/portal_components/test.erp5.testERP5Discussion.xml
...teItem/portal_components/test.erp5.testERP5Discussion.xml
+6
-25
No files found.
bt5/erp5_discussion/TestTemplateItem/portal_components/test.erp5.testERP5Discussion.py
View file @
c9d46da7
...
...
@@ -68,6 +68,16 @@ class TestERP5Discussion(DocumentUploadTestCase):
def
stepCreatePost
(
self
,
thread
):
return
thread
.
newContent
(
portal_type
=
"Discussion Post"
)
def
stepCreateForumWebSection
(
self
,
group
,
web_site
):
web_section
=
web_site
.
newContent
(
portal_type
=
'Web Section'
)
module
=
self
.
portal
.
getDefaultModule
(
"Discussion Forum"
)
forum
=
module
.
newContent
(
portal_type
=
"Discussion Forum"
)
forum
.
setMultimembershipCriterionBaseCategoryList
([
'group'
])
forum
.
setMembershipCriterionCategoryList
([
group
.
getRelativeUrl
()])
forum
.
setCategoryList
([
group
.
getRelativeUrl
()])
web_section
.
WebSection_configurePredicateForForum
(
forum_relative_url
=
forum
.
getRelativeUrl
())
return
web_section
def
test_01_createDiscussionThread
(
self
):
"""Create a new discussion thread"""
...
...
@@ -97,15 +107,21 @@ class TestERP5Discussion(DocumentUploadTestCase):
portal
=
self
.
portal
discussion_thread_id_set
=
set
(
portal
.
discussion_thread_module
.
objectIds
())
# create web section
s
& set predicates
# create web section
, forum
& set predicates
group1
=
portal
.
portal_categories
.
group
.
newContent
(
portal_type
=
'Category'
,
title
=
'Group 1'
)
web_site
=
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
)
web_section1
=
web_site
.
newContent
(
portal_type
=
'Web Section'
)
web_section1
.
setMultimembershipCriterionBaseCategoryList
([
'group'
])
web_section1
.
setMembershipCriterionCategoryList
([
group1
.
getRelativeUrl
()])
web_section1
=
self
.
stepCreateForumWebSection
(
group1
,
web_site
)
self
.
tic
()
# check forum is created and linked
result
=
list
(
web_section1
.
searchResults
(
portal_type
=
"Discussion Forum"
))
if
result
:
forum
=
result
[
0
]
self
.
assertTrue
(
forum
)
self
.
assertEqual
(
forum
.
getPortalType
(),
"Discussion Forum"
)
self
.
assertEqual
([
group1
.
getRelativeUrl
()],
forum
.
getMembershipCriterionCategoryList
())
web_section1
.
WebSection_createNewDiscussionThread
(
'test1-new'
,
'test1 body'
)
discussion_thread
,
=
[
x
for
x
in
self
.
portal
.
discussion_thread_module
.
objectValues
()
\
if
x
.
getId
()
not
in
discussion_thread_id_set
]
...
...
@@ -146,20 +162,23 @@ class TestERP5Discussion(DocumentUploadTestCase):
"""
portal
=
self
.
portal
# create web sections & set predicates
# create web sections
, forums
& set predicates
group1
=
portal
.
portal_categories
.
group
.
newContent
(
portal_type
=
'Category'
,
title
=
'Group 1'
)
group2
=
portal
.
portal_categories
.
group
.
newContent
(
portal_type
=
'Category'
,
title
=
'Group 2'
)
web_site
=
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
)
web_section1
=
web_site
.
newContent
(
portal_type
=
'Web Section'
)
web_section2
=
web_site
.
newContent
(
portal_type
=
'Web Section'
)
web_section1
.
setMultimembershipCriterionBaseCategoryList
([
'group'
])
web_section1
.
setMembershipCriterionCategoryList
([
group1
.
getRelativeUrl
()])
web_section2
.
setMultimembershipCriterionBaseCategoryList
([
'group'
])
web_section2
.
setMembershipCriterionCategoryList
([
group2
.
getRelativeUrl
()])
web_section1
=
self
.
stepCreateForumWebSection
(
group1
,
web_site
)
web_section2
=
self
.
stepCreateForumWebSection
(
group2
,
web_site
)
self
.
tic
()
result
=
list
(
web_section1
.
searchResults
(
portal_type
=
"Discussion Forum"
))
if
result
:
forum1
=
result
[
0
]
result
=
list
(
web_section2
.
searchResults
(
portal_type
=
"Discussion Forum"
))
if
result
:
forum2
=
result
[
0
]
# add threads on Web Section context
web_section1
.
WebSection_createNewDiscussionThread
(
'test1'
,
'test1 body'
)
web_section2
.
WebSection_createNewDiscussionThread
(
'test2'
,
'test2 body'
)
...
...
@@ -168,13 +187,13 @@ class TestERP5Discussion(DocumentUploadTestCase):
title
=
'test1'
)
discussion_thread_object2
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Discussion Thread'
,
title
=
'test2'
)
self
.
assertEqual
(
group1
,
discussion_thread_object1
.
getGroupValue
())
self
.
assertEqual
(
group2
,
discussion_thread_object2
.
getGroupValue
())
# check getDocumentValue.. on Web Section context (by default forum is public
# so threads should be part of document list)
self
.
assertSameSet
([
discussion_thread_object1
],
[
x
.
getObject
()
for
x
in
web_section1
.
getDocumentValueList
()])
self
.
assertSameSet
([
discussion_thread_object2
],
[
x
.
getObject
()
for
x
in
web_section2
.
getDocumentValueList
()])
# check forum predicate search.. on Discussion Forum context
self
.
assertSameSet
([
discussion_thread_object1
],
[
x
.
getObject
()
for
x
in
forum1
.
searchResults
()])
self
.
assertSameSet
([
discussion_thread_object2
],
[
x
.
getObject
()
for
x
in
forum2
.
searchResults
()])
# test RSS generation by testing indirectly its "get" method
# (new post should be first in list)
...
...
bt5/erp5_discussion/TestTemplateItem/portal_components/test.erp5.testERP5Discussion.xml
View file @
c9d46da7
...
...
@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testERP5Discussion
</string>
</value>
...
...
@@ -49,7 +43,9 @@
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
<tuple>
<string>
W: 33, 0: Unused newSecurityManager imported from AccessControl.SecurityManagement (unused-import)
</string>
</tuple>
</value>
</item>
<item>
...
...
@@ -59,28 +55,13 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -93,7 +74,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -102,7 +83,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment