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
Carlos Ramos Carreño
erp5
Commits
6635625a
Commit
6635625a
authored
Feb 08, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
officejs_support_request_ui_test: py3
parent
a13ff9c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
bt5/erp5_officejs_support_request_ui_test/TestTemplateItem/portal_components/test.erp5.testSupportRequest.py
...ateItem/portal_components/test.erp5.testSupportRequest.py
+15
-15
No files found.
bt5/erp5_officejs_support_request_ui_test/TestTemplateItem/portal_components/test.erp5.testSupportRequest.py
View file @
6635625a
...
@@ -24,8 +24,8 @@
...
@@ -24,8 +24,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
##############################################################################
##############################################################################
import
io
import
json
import
json
from
six.moves
import
cStringIO
as
StringIO
import
six.moves.urllib.parse
import
six.moves.urllib.parse
import
six.moves.http_client
import
six.moves.http_client
...
@@ -33,7 +33,7 @@ import feedparser
...
@@ -33,7 +33,7 @@ import feedparser
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
class
FileUpload
(
String
IO
):
class
FileUpload
(
io
.
Bytes
IO
):
filename
=
'attached_file.txt'
filename
=
'attached_file.txt'
...
@@ -183,7 +183,7 @@ class TestSupportRequestCreateNewSupportRequest(SupportRequestTestCase):
...
@@ -183,7 +183,7 @@ class TestSupportRequestCreateNewSupportRequest(SupportRequestTestCase):
post
,
=
web_message
.
getAggregateValueList
(
post
,
=
web_message
.
getAggregateValueList
(
portal_type
=
'HTML Post'
portal_type
=
'HTML Post'
)
)
self
.
assertEqual
(
'<b>Help !!!</b>'
,
str
(
post
.
getData
()))
self
.
assertEqual
(
b'<b>Help !!!</b>'
,
bytes
(
post
.
getData
()))
# post have been archived once ingested
# post have been archived once ingested
self
.
assertEqual
(
'archived'
,
post
.
getValidationState
())
self
.
assertEqual
(
'archived'
,
post
.
getValidationState
())
...
@@ -201,7 +201,7 @@ class TestSupportRequestCreateNewSupportRequest(SupportRequestTestCase):
...
@@ -201,7 +201,7 @@ class TestSupportRequestCreateNewSupportRequest(SupportRequestTestCase):
def
test_submit_support_request_with_attachment
(
self
):
def
test_submit_support_request_with_attachment
(
self
):
self
.
getWebSite
().
SupportRequestModule_createSupportRequest
(
self
.
getWebSite
().
SupportRequestModule_createSupportRequest
(
description
=
'<b>Look at this file !</b>'
,
description
=
'<b>Look at this file !</b>'
,
file
=
FileUpload
(
"the text content"
),
file
=
FileUpload
(
b
"the text content"
),
resource
=
self
.
portal
.
service_module
.
erp5_officejs_support_request_ui_test_service_001
.
getRelativeUrl
(),
resource
=
self
.
portal
.
service_module
.
erp5_officejs_support_request_ui_test_service_001
.
getRelativeUrl
(),
title
=
self
.
id
(),
title
=
self
.
id
(),
project
=
'erp5_officejs_support_request_ui_test_project_001'
,
project
=
'erp5_officejs_support_request_ui_test_project_001'
,
...
@@ -234,16 +234,16 @@ class TestSupportRequestCreateNewSupportRequest(SupportRequestTestCase):
...
@@ -234,16 +234,16 @@ class TestSupportRequestCreateNewSupportRequest(SupportRequestTestCase):
post
,
=
web_message
.
getAggregateValueList
(
post
,
=
web_message
.
getAggregateValueList
(
portal_type
=
'HTML Post'
portal_type
=
'HTML Post'
)
)
self
.
assertEqual
(
'<b>Look at this file !</b>'
,
str
(
post
.
getData
()))
self
.
assertEqual
(
b'<b>Look at this file !</b>'
,
bytes
(
post
.
getData
()))
file_post
,
=
post
.
getSuccessorValueList
()
file_post
,
=
post
.
getSuccessorValueList
()
self
.
assertEqual
(
'the text content'
,
str
(
file_post
.
getData
()))
self
.
assertEqual
(
b'the text content'
,
bytes
(
file_post
.
getData
()))
# a text was ingested from the file post
# a text was ingested from the file post
file_document
,
=
web_message
.
getAggregateValueList
(
file_document
,
=
web_message
.
getAggregateValueList
(
portal_type
=
'Text'
portal_type
=
'Text'
)
)
self
.
assertEqual
(
'attached_file.txt'
,
file_document
.
getFilename
())
self
.
assertEqual
(
'attached_file.txt'
,
file_document
.
getFilename
())
self
.
assertEqual
(
'the text content'
,
str
(
file_document
.
getData
()))
self
.
assertEqual
(
b'the text content'
,
bytes
(
file_document
.
getData
()))
self
.
assertEqual
(
self
.
assertEqual
(
[
dict
(
[
dict
(
...
@@ -262,7 +262,7 @@ class TestSupportRequestCommentOnExistingSupportRequest(SupportRequestTestCase):
...
@@ -262,7 +262,7 @@ class TestSupportRequestCommentOnExistingSupportRequest(SupportRequestTestCase):
self
.
portal
.
PostModule_createHTMLPostForSupportRequest
(
self
.
portal
.
PostModule_createHTMLPostForSupportRequest
(
follow_up
=
support_request
.
getRelativeUrl
(),
follow_up
=
support_request
.
getRelativeUrl
(),
predecessor
=
None
,
predecessor
=
None
,
data
=
"<p>Hello !</p>"
,
data
=
b
"<p>Hello !</p>"
,
file
=
None
,
file
=
None
,
source_reference
=
"xxx-message-id"
,
source_reference
=
"xxx-message-id"
,
web_site_relative_url
=
self
.
getWebSite
().
getRelativeUrl
(),
web_site_relative_url
=
self
.
getWebSite
().
getRelativeUrl
(),
...
@@ -300,8 +300,8 @@ class TestSupportRequestCommentOnExistingSupportRequest(SupportRequestTestCase):
...
@@ -300,8 +300,8 @@ class TestSupportRequestCommentOnExistingSupportRequest(SupportRequestTestCase):
self
.
portal
.
PostModule_createHTMLPostForSupportRequest
(
self
.
portal
.
PostModule_createHTMLPostForSupportRequest
(
follow_up
=
support_request
.
getRelativeUrl
(),
follow_up
=
support_request
.
getRelativeUrl
(),
predecessor
=
None
,
predecessor
=
None
,
data
=
"<p>Please look at the <b>attached file</b></p>"
,
data
=
b
"<p>Please look at the <b>attached file</b></p>"
,
file
=
FileUpload
(
"the text content"
),
file
=
FileUpload
(
b
"the text content"
),
source_reference
=
"xxx-message-id"
,
source_reference
=
"xxx-message-id"
,
web_site_relative_url
=
self
.
getWebSite
().
getRelativeUrl
(),
web_site_relative_url
=
self
.
getWebSite
().
getRelativeUrl
(),
)
)
...
@@ -327,7 +327,7 @@ class TestSupportRequestCommentOnExistingSupportRequest(SupportRequestTestCase):
...
@@ -327,7 +327,7 @@ class TestSupportRequestCommentOnExistingSupportRequest(SupportRequestTestCase):
portal_type
=
'Text'
portal_type
=
'Text'
)
)
self
.
assertEqual
(
'attached_file.txt'
,
file_document
.
getFilename
())
self
.
assertEqual
(
'attached_file.txt'
,
file_document
.
getFilename
())
self
.
assertEqual
(
'the text content'
,
str
(
file_document
.
getData
()))
self
.
assertEqual
(
b'the text content'
,
bytes
(
file_document
.
getData
()))
self
.
assertEqual
(
'shared'
,
file_document
.
getValidationState
())
self
.
assertEqual
(
'shared'
,
file_document
.
getValidationState
())
# this document is also attached to the context of the support request
# this document is also attached to the context of the support request
# and is visible from the document tab.
# and is visible from the document tab.
...
@@ -352,7 +352,7 @@ class TestSupportRequestCommentOnExistingSupportRequest(SupportRequestTestCase):
...
@@ -352,7 +352,7 @@ class TestSupportRequestCommentOnExistingSupportRequest(SupportRequestTestCase):
follow_up
=
support_request
.
getRelativeUrl
(),
follow_up
=
support_request
.
getRelativeUrl
(),
predecessor
=
None
,
predecessor
=
None
,
data
=
"<p>look <script>alert('haha')</script></p>"
,
data
=
"<p>look <script>alert('haha')</script></p>"
,
file
=
FileUpload
(
"the text content"
),
file
=
FileUpload
(
b
"the text content"
),
source_reference
=
"xxx-message-id"
,
source_reference
=
"xxx-message-id"
,
web_site_relative_url
=
self
.
getWebSite
().
getRelativeUrl
(),
web_site_relative_url
=
self
.
getWebSite
().
getRelativeUrl
(),
)
)
...
@@ -367,8 +367,8 @@ class TestSupportRequestCommentOnExistingSupportRequest(SupportRequestTestCase):
...
@@ -367,8 +367,8 @@ class TestSupportRequestCommentOnExistingSupportRequest(SupportRequestTestCase):
# but the post follow the "store what user entered as-is" rule.
# but the post follow the "store what user entered as-is" rule.
# (so looking at posts can be dangerous)
# (so looking at posts can be dangerous)
self
.
assertEqual
(
self
.
assertEqual
(
"<p>look <script>alert('haha')</script></p>"
,
b
"<p>look <script>alert('haha')</script></p>"
,
str
(
post
.
getData
()))
bytes
(
post
.
getData
()))
def
test_support_request_comment_include_other_event_type
(
self
):
def
test_support_request_comment_include_other_event_type
(
self
):
support_request
=
self
.
portal
.
support_request_module
.
erp5_officejs_support_request_ui_test_support_reuqest_001
support_request
=
self
.
portal
.
support_request_module
.
erp5_officejs_support_request_ui_test_support_reuqest_001
...
@@ -626,7 +626,7 @@ class TestIngestPostAsWebMessage(SupportRequestTestCase):
...
@@ -626,7 +626,7 @@ class TestIngestPostAsWebMessage(SupportRequestTestCase):
post
=
self
.
portal
.
post_module
.
newContent
(
post
=
self
.
portal
.
post_module
.
newContent
(
portal_type
=
'HTML Post'
,
portal_type
=
'HTML Post'
,
follow_up_value
=
support_request
,
follow_up_value
=
support_request
,
data
=
"Hello"
data
=
b
"Hello"
)
)
post
.
publish
()
post
.
publish
()
self
.
tic
()
self
.
tic
()
...
...
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