Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
6d37ca31
Commit
6d37ca31
authored
Jun 17, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: WIP: content type parameter seems useless
parent
595fee10
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
2 deletions
+91
-2
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Ticket_createProjectEvent.py
..._skins/slapos_crm_monitoring/Ticket_createProjectEvent.py
+4
-1
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Ticket_createProjectEvent.xml
...skins/slapos_crm_monitoring/Ticket_createProjectEvent.xml
+1
-1
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
+86
-0
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Ticket_createProjectEvent.py
View file @
6d37ca31
...
...
@@ -3,6 +3,10 @@ It creates new Event for any context which become follow_up of created Event.
"""
from
erp5.component.tool.NotificationTool
import
buildEmailMessage
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
raise
Unauthorized
portal
=
context
.
getPortalObject
()
ticket
=
context
REQUEST
=
context
.
REQUEST
...
...
@@ -62,7 +66,6 @@ event_kw = {
'follow_up_value'
:
ticket
,
'language'
:
language
,
'data'
:
email
.
as_string
(),
'content_type'
:
content_type
,
}
# Create event
module
=
portal
.
getDefaultModule
(
portal_type
=
portal_type
)
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Ticket_createProjectEvent.xml
View file @
6d37ca31
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
title, direction, portal_type, resource, text_content,
content_type, attachment=None, notification_message=None, substitution_method_parameter_dict=None, keep_draft=False, source=None, destination=None, language=None, comment
=None, **kw
</string>
</value>
<value>
<string>
title, direction, portal_type, resource, text_content,
attachment=None, notification_message=None, substitution_method_parameter_dict=None, keep_draft=False, source=None, destination=None, language=None, comment=None, REQUEST
=None, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
View file @
6d37ca31
...
...
@@ -27,6 +27,7 @@ from erp5.component.test.SlapOSTestCaseMixin import \
from
DateTime
import
DateTime
from
App.Common
import
rfc1123_date
from
zExceptions
import
Unauthorized
def
getFakeSlapState
():
...
...
@@ -423,3 +424,88 @@ class TestSlapOSFolder_getTicketFeedUrl(TestCRMSkinsMixin):
def
test_Folder_getTicketFeedUrl_incident_response_module
(
self
):
self
.
_test
(
self
.
portal
.
incident_response_module
)
class
TestTicket_createProjectEvent
(
TestCRMSkinsMixin
):
def
createUsualTicket
(
self
):
portal
=
self
.
portal
return
portal
.
support_request_module
.
newContent
(
portal_type
=
'Support Request'
,
title
=
'test support request'
,
source_value
=
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
title
=
'ticket source person'
),
source_section_value
=
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
title
=
'ticket source section organisation'
),
source_project_value
=
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
,
title
=
'ticket source project'
),
destination_value
=
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
,
title
=
'ticket destination person'
),
destination_section_value
=
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
title
=
'ticket destination section organisation'
),
destination_project_value
=
portal
.
project_module
.
newContent
(
portal_type
=
'Project'
,
title
=
'ticket destination project'
),
)
def
test_Ticket_createProjectEvent_REQUEST_disallowed
(
self
):
ticket
=
self
.
createUsualTicket
()
self
.
assertRaises
(
Unauthorized
,
ticket
.
Ticket_createProjectEvent
,
'foo_title'
,
'foo_direction'
,
'foo portal type'
,
'foo resource'
,
'foo text'
,
REQUEST
=
{})
def
test_Ticket_createProjectEvent_incoming_event
(
self
):
ticket
=
self
.
createUsualTicket
()
event
=
ticket
.
Ticket_createProjectEvent
(
'foo_title'
,
'incoming'
,
'Letter'
,
'foo resource'
,
'foo text'
,
)
self
.
assertEquals
(
event
.
getPortalType
(),
'Letter'
)
self
.
assertEquals
(
event
.
getTitle
(),
'foo_title'
)
self
.
assertEquals
(
event
.
getFollowUp
(),
ticket
.
getRelativeUrl
())
self
.
assertEquals
(
event
.
getResource
(),
'foo resource'
)
self
.
assertEquals
(
event
.
getSource
(),
ticket
.
getDestination
())
self
.
assertEquals
(
event
.
getSourceSection
(),
ticket
.
getDestinationSection
())
self
.
assertEquals
(
event
.
getSourceProject
(),
ticket
.
getDestinationProject
())
self
.
assertEquals
(
event
.
getDestination
(),
ticket
.
getSource
())
self
.
assertEquals
(
event
.
getDestinationSection
(),
ticket
.
getSourceSection
())
self
.
assertEquals
(
event
.
getDestinationProject
(),
ticket
.
getSourceProject
())
self
.
assertEquals
(
event
.
getTextContent
(),
'foo text'
)
self
.
assertEquals
(
event
.
getContentType
(),
'text/plain'
)
self
.
assertSameSet
([
x
for
x
in
event
.
getAttachmentInformationList
()
if
x
[
'uid'
]
!=
x
[
'filename'
]],
[])
self
.
assertEquals
(
event
.
getSimulationState
(),
'stopped'
)
def
test_Ticket_createProjectEvent_outgoing_event
(
self
):
ticket
=
self
.
createUsualTicket
()
event
=
ticket
.
Ticket_createProjectEvent
(
'foo_title'
,
'outgoing'
,
'Web Message'
,
'foo resource'
,
'foo text'
,
)
self
.
assertEquals
(
event
.
getPortalType
(),
'Web Message'
)
self
.
assertEquals
(
event
.
getTitle
(),
'foo_title'
)
self
.
assertEquals
(
event
.
getFollowUp
(),
ticket
.
getRelativeUrl
())
self
.
assertEquals
(
event
.
getResource
(),
'foo resource'
)
self
.
assertEquals
(
event
.
getDestination
(),
ticket
.
getDestination
())
self
.
assertEquals
(
event
.
getDestinationSection
(),
ticket
.
getDestinationSection
())
self
.
assertEquals
(
event
.
getDestinationProject
(),
ticket
.
getDestinationProject
())
self
.
assertEquals
(
event
.
getSource
(),
ticket
.
getSource
())
self
.
assertEquals
(
event
.
getSourceSection
(),
ticket
.
getSourceSection
())
self
.
assertEquals
(
event
.
getSourceProject
(),
ticket
.
getSourceProject
())
self
.
assertEquals
(
event
.
getTextContent
(),
'foo text'
)
self
.
assertEquals
(
event
.
getContentType
(),
'text/plain'
)
self
.
assertSameSet
([
x
for
x
in
event
.
getAttachmentInformationList
()
if
x
[
'uid'
]
!=
x
[
'filename'
]],
[])
self
.
assertEquals
(
event
.
getSimulationState
(),
'delivered'
)
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