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
02a409c3
Commit
02a409c3
authored
Jun 17, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: test test
parent
31eb1b80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
4 deletions
+59
-4
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
+59
-4
No files found.
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
View file @
02a409c3
...
...
@@ -24,6 +24,8 @@
import
transaction
from
erp5.component.test.SlapOSTestCaseMixin
import
\
SlapOSTestCaseMixin
,
SlapOSTestCaseMixinWithAbort
,
TemporaryAlarmScript
,
PinnedDateTime
from
Products.ERP5Type.tests.utils
import
FileUpload
import
os
from
DateTime
import
DateTime
from
App.Common
import
rfc1123_date
...
...
@@ -458,6 +460,33 @@ class TestTicket_createProjectEvent(TestCRMSkinsMixin):
),
)
def
makeImageFileUpload
(
self
):
import
Products.ERP5.tests
file_upload
=
FileUpload
(
os
.
path
.
join
(
os
.
path
.
dirname
(
Products
.
ERP5
.
tests
.
__file__
),
'test_data'
,
'images'
,
'erp5_logo.png'
))
file_upload
.
headers
[
'Content-Type'
]
=
'image/png'
return
file_upload
def
assertSameEventAttachmentList
(
self
,
event
,
information_dict_list
=
None
):
if
information_dict_list
is
None
:
information_dict_list
=
[]
event_information_dict_list
=
[]
for
information
in
event
.
getAttachmentInformationList
():
if
information
[
'uid'
]
!=
information
[
'filename'
]:
event_information_dict_list
.
append
({
'title'
:
information
[
'filename'
],
'content_type'
:
information
[
'content_type'
],
'index'
:
information
[
'index'
]
})
import
json
self
.
assertSameSet
(
[
json
.
dumps
(
x
)
for
x
in
event_information_dict_list
],
[
json
.
dumps
(
x
)
for
x
in
information_dict_list
]
)
def
test_Ticket_createProjectEvent_REQUEST_disallowed
(
self
):
ticket
=
self
.
createUsualTicket
()
self
.
assertRaises
(
...
...
@@ -467,7 +496,7 @@ class TestTicket_createProjectEvent(TestCRMSkinsMixin):
'foo resource'
,
'foo text'
,
REQUEST
=
{})
def
test_Ticket_createProjectEvent_incoming
_ev
ent
(
self
):
def
test_Ticket_createProjectEvent_incoming
EventWithoutAttachm
ent
(
self
):
ticket
=
self
.
createUsualTicket
()
event
=
ticket
.
Ticket_createProjectEvent
(
'foo_title'
,
'incoming'
,
'Letter'
,
...
...
@@ -485,10 +514,36 @@ class TestTicket_createProjectEvent(TestCRMSkinsMixin):
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
.
assertSameEventAttachmentList
(
event
)
self
.
assertEquals
(
event
.
getSimulationState
(),
'stopped'
)
def
test_Ticket_createProjectEvent_incomingEventWithAttachment
(
self
):
ticket
=
self
.
createUsualTicket
()
event
=
ticket
.
Ticket_createProjectEvent
(
'foo_title'
,
'incoming'
,
'Web Message'
,
'foo resource'
,
'foo text'
,
attachment
=
self
.
makeImageFileUpload
()
)
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
.
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
.
assertSameEventAttachmentList
(
event
,
[{
"index"
:
2
,
"content_type"
:
"image/png"
,
"title"
:
"erp5_logo.png"
}])
self
.
assertEquals
(
event
.
getSimulationState
(),
'stopped'
)
def
test_Ticket_createProjectEvent_outgoing
_e
vent
(
self
):
def
test_Ticket_createProjectEvent_outgoing
E
vent
(
self
):
ticket
=
self
.
createUsualTicket
()
event
=
ticket
.
Ticket_createProjectEvent
(
'foo_title'
,
'outgoing'
,
'Web Message'
,
...
...
@@ -506,6 +561,6 @@ class TestTicket_createProjectEvent(TestCRMSkinsMixin):
self
.
assertEquals
(
event
.
getSourceProject
(),
ticket
.
getSourceProject
())
self
.
assertEquals
(
event
.
getTextContent
(),
'foo text'
)
self
.
assertEquals
(
event
.
getContentType
(),
'text/plain'
)
self
.
assertSame
Set
([
x
for
x
in
event
.
getAttachmentInformationList
()
if
x
[
'uid'
]
!=
x
[
'filename'
]],
[]
)
self
.
assertSame
EventAttachmentList
(
event
)
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