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
a3e33f96
Commit
a3e33f96
authored
Sep 29, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: fixup RegularisationRequest_checkToSendUniqEvent tests
parent
b9dbb9a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
9 deletions
+62
-9
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
...ents/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
+62
-9
No files found.
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
View file @
a3e33f96
...
...
@@ -28,9 +28,13 @@ from zExceptions import Unauthorized
from
DateTime
import
DateTime
class
TestSlapOSRegularisationRequest_checkToSendUniqEvent
(
SlapOSTestCaseMixin
):
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
expected_slapos_organisation
=
self
.
portal
.
organisation_module
.
newContent
(
default_email_coordinate_text
=
"foo@example.org"
)
self
.
expected_slapos_organisation
=
expected_slapos_organisation
.
getRelativeUrl
()
def
createRegularisationRequest
(
self
):
new_id
=
self
.
generateNewId
()
...
...
@@ -41,7 +45,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
resource
=
'foo/bar'
,
)
def
test_checkToSendUniqEvent_no
_e
vent
(
self
):
def
test_checkToSendUniqEvent_no
E
vent
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
...
...
@@ -69,8 +73,56 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
self
.
assertEqual
(
event
.
getSource
(),
self
.
expected_slapos_organisation
)
self
.
assertEqual
(
event
.
getDestination
(),
person
.
getRelativeUrl
())
self
.
assertEqual
(
event
.
getTextContent
(),
'foo content'
)
self
.
assertEqual
(
event
.
getContentType
(),
'text/plain'
)
def
test_checkToSendUniqEvent_notificationMessage
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
ticket
.
edit
(
source
=
self
.
expected_slapos_organisation
,
destination_value
=
person
,
source_project_value
=
person
)
ticket
.
validate
()
ticket
.
suspend
()
before_date
=
DateTime
()
notification_message_reference
=
'test_checkToSendUniqEvent_notificationMessage%s'
%
self
.
generateNewId
()
notification_message
=
self
.
portal
.
notification_message_module
.
newContent
(
portal_type
=
"Notification Message"
,
reference
=
notification_message_reference
,
title
=
'notification title ${foo}'
,
text_content_substitution_mapping_method_id
=
'NotificationMessage_getSubstitutionMappingDictFromEvent'
,
text_content
=
'notification content ${foo}'
,
content_type
=
'text/html'
,
)
notification_message
.
validate
()
self
.
tic
()
def
test_checkToSendUniqEvent_service_required
(
self
):
event
=
ticket
.
RegularisationRequest_checkToSendUniqEvent
(
'service_module/slapos_crm_spam'
,
'foo title'
,
'foo content'
,
'foo comment'
,
notification_message
=
notification_message_reference
,
substitution_method_parameter_dict
=
{
'foo'
:
'bar'
}
)
after_date
=
DateTime
()
self
.
assertEqual
(
ticket
.
getSimulationState
(),
'suspended'
)
self
.
assertEqual
(
ticket
.
getResource
(),
'service_module/slapos_crm_spam'
)
self
.
assertEqual
(
event
.
getPortalType
(),
'Mail Message'
)
self
.
assertEqual
(
event
.
getSimulationState
(),
'delivered'
)
self
.
assertTrue
(
event
.
getStartDate
()
>=
before_date
)
self
.
assertTrue
(
event
.
getStopDate
()
<=
after_date
)
self
.
assertEqual
(
event
.
getTitle
(),
"notification title bar"
)
self
.
assertEqual
(
event
.
getResource
(),
'service_module/slapos_crm_spam'
)
self
.
assertEqual
(
event
.
getFollowUp
(),
ticket
.
getRelativeUrl
())
self
.
assertEqual
(
event
.
getSource
(),
self
.
expected_slapos_organisation
)
self
.
assertEqual
(
event
.
getDestination
(),
person
.
getRelativeUrl
())
self
.
assertEqual
(
event
.
getTextContent
(),
'notification content bar'
)
self
.
assertEqual
(
event
.
getContentType
(),
'text/html'
)
def
test_checkToSendUniqEvent_serviceRequired
(
self
):
ticket
=
self
.
createRegularisationRequest
()
self
.
assertRaises
(
AssertionError
,
...
...
@@ -78,7 +130,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
ticket
.
getRelativeUrl
(),
''
,
''
,
''
)
def
test_checkToSendUniqEvent_call
_twice_with_t
ic
(
self
):
def
test_checkToSendUniqEvent_call
TwiceWithT
ic
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
...
...
@@ -98,7 +150,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
self
.
assertEqual
(
event
.
getTextContent
(),
'foo content'
)
self
.
assertEqual
(
event
.
getRelativeUrl
(),
event2
.
getRelativeUrl
())
def
test_checkToSendUniqEvent_manual
_e
vent
(
self
):
def
test_checkToSendUniqEvent_manual
E
vent
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
...
...
@@ -124,7 +176,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
self
.
assertEqual
(
event
.
getSimulationState
(),
'draft'
)
self
.
assertEqual
(
event
.
getRelativeUrl
(),
event2
.
getRelativeUrl
())
def
test_checkToSendUniqEvent_not
_s
uspended
(
self
):
def
test_checkToSendUniqEvent_not
S
uspended
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
...
...
@@ -138,7 +190,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
'service_module/slapos_crm_spam'
,
'foo2 title'
,
'foo2 content'
,
'foo2 comment'
)
self
.
assertEqual
(
event
,
None
)
def
test_checkToSendUniqEvent_event
_not_r
eindexed
(
self
):
def
test_checkToSendUniqEvent_event
NotR
eindexed
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
...
...
@@ -156,7 +208,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
self
.
assertNotEqual
(
event
,
event2
)
self
.
assertEqual
(
event2
,
None
)
def
test_checkToSendUniqEvent_REQUEST
_
disallowed
(
self
):
def
test_checkToSendUniqEvent_REQUESTdisallowed
(
self
):
ticket
=
self
.
createRegularisationRequest
()
self
.
assertRaises
(
Unauthorized
,
...
...
@@ -164,6 +216,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
''
,
''
,
''
,
''
,
REQUEST
=
{})
class
TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep
(
SlapOSTestCaseMixinWithAbort
):
...
...
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