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
ee0b13b6
Commit
ee0b13b6
authored
Sep 29, 2023
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: test RegularisationRequest_stopInstanceTreeList
parent
70607cef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
179 additions
and
182 deletions
+179
-182
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_stopInstanceTreeList.py
.../slapos_crm/RegularisationRequest_stopInstanceTreeList.py
+2
-2
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
...ateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
+177
-0
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
...ents/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
+0
-180
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_stopInstanceTreeList.py
View file @
ee0b13b6
...
...
@@ -8,12 +8,12 @@ person = ticket.getDestinationDecisionValue(portal_type="Person")
if
(
state
==
'suspended'
)
and
\
(
person
is
not
None
)
and
\
(
ticket
.
getResource
()
in
[
'service_module/slapos_crm_stop_acknowledgement'
,
'service_module/slapos_crm_delete_reminder'
,
'service_module/slapos_crm_delete_acknowledgement'
]):
portal
=
context
.
getPortalObject
()
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
"Instance Tree"
,
validation_state
=
[
"validated"
],
de
fault_destination_section
_uid
=
person
.
getUid
(),
de
stination_section_
_uid
=
person
.
getUid
(),
method_id
=
'InstanceTree_stopFromRegularisationRequest'
,
method_args
=
(
person
.
getRelativeUrl
(),),
activate_kw
=
{
'tag'
:
tag
}
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
View file @
ee0b13b6
...
...
@@ -847,6 +847,183 @@ class TestSlapOSCrmStopInstanceTree(SlapOSTestCaseMixinWithAbort):
slapos_crm_stop_instance_tree
self
.
_test_alarm_not_visited
(
alarm
,
ticket
,
"RegularisationRequest_stopInstanceTreeList"
)
def
createInstanceTree
(
self
):
new_id
=
self
.
generateNewId
()
instance_tree
=
self
.
portal
.
instance_tree_module
\
.
template_instance_tree
.
Base_createCloneDocument
(
batch_mode
=
1
)
instance_tree
.
edit
(
reference
=
"TESTHS-%s"
%
new_id
,
)
instance_tree
.
validate
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
instance_tree
,
'start_requested'
)
return
instance_tree
def
test_RegularisationRequest_stopInstanceTreeList_script_REQUESTdisallowed
(
self
):
ticket
=
self
.
createRegularisationRequest
()
self
.
assertRaises
(
Unauthorized
,
ticket
.
RegularisationRequest_stopInstanceTreeList
,
'footag'
,
REQUEST
=
{})
@
simulate
(
'InstanceTree_stopFromRegularisationRequest'
,
'person, REQUEST=None'
,
'context.portal_workflow.doActionFor('
\
'context, action="edit_action", '
\
'comment="Visited by InstanceTree_stopFromRegularisationRequest '
\
'%s" % (person))'
)
def
test_RegularisationRequest_stopInstanceTreeList_script_matchingSubscription
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
instance_tree
=
self
.
createInstanceTree
()
ticket
.
edit
(
destination_decision_value
=
person
,
resource
=
'service_module/slapos_crm_stop_acknowledgement'
,
)
ticket
.
validate
()
ticket
.
suspend
()
instance_tree
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
)
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_stopInstanceTreeList
(
'footag'
)
self
.
assertTrue
(
result
)
self
.
tic
()
self
.
assertEqual
(
'Visited by InstanceTree_stopFromRegularisationRequest '
\
'%s'
%
person
.
getRelativeUrl
(),
instance_tree
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
@
simulate
(
'InstanceTree_stopFromRegularisationRequest'
,
'person, REQUEST=None'
,
'context.portal_workflow.doActionFor('
\
'context, action="edit_action", '
\
'comment="Visited by InstanceTree_stopFromRegularisationRequest '
\
'%s" % (person))'
)
def
test_RegularisationRequest_stopInstanceTreeList_script_matchingSubscription2
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
instance_tree
=
self
.
createInstanceTree
()
ticket
.
edit
(
destination_decision_value
=
person
,
resource
=
'service_module/slapos_crm_delete_reminder'
,
)
ticket
.
validate
()
ticket
.
suspend
()
instance_tree
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
)
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_stopInstanceTreeList
(
'footag'
)
self
.
assertTrue
(
result
)
self
.
tic
()
self
.
assertEqual
(
'Visited by InstanceTree_stopFromRegularisationRequest '
\
'%s'
%
person
.
getRelativeUrl
(),
instance_tree
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
@
simulate
(
'InstanceTree_stopFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_RegularisationRequest_stopInstanceTreeList_script_otherSubscription
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
self
.
createInstanceTree
()
ticket
.
edit
(
destination_decision_value
=
person
,
resource
=
'service_module/slapos_crm_stop_acknowledgement'
,
)
ticket
.
validate
()
ticket
.
suspend
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_stopInstanceTreeList
(
'footag'
)
self
.
assertTrue
(
result
)
self
.
tic
()
@
simulate
(
'InstanceTree_stopFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_RegularisationRequest_stopInstanceTreeList_script_noPerson
(
self
):
ticket
=
self
.
createRegularisationRequest
()
ticket
.
edit
(
resource
=
'service_module/slapos_crm_stop_acknowledgement'
,
)
ticket
.
validate
()
ticket
.
suspend
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_stopInstanceTreeList
(
'footag'
)
self
.
assertFalse
(
result
)
self
.
tic
()
@
simulate
(
'InstanceTree_stopFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_RegularisationRequest_stopInstanceTreeList_script_notSuspended
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
self
.
createInstanceTree
()
ticket
.
edit
(
destination_decision_value
=
person
,
resource
=
'service_module/slapos_crm_stop_acknowledgement'
,
)
ticket
.
validate
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_stopInstanceTreeList
(
'footag'
)
self
.
assertFalse
(
result
)
self
.
tic
()
@
simulate
(
'InstanceTree_stopFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_RegularisationRequest_stopInstanceTreeList_script_otherResource
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
self
.
createInstanceTree
()
ticket
.
edit
(
destination_decision_value
=
person
,
resource
=
'service_module/slapos_crm_acknowledgement'
,
)
ticket
.
validate
()
ticket
.
suspend
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_stopInstanceTreeList
(
'footag'
)
self
.
assertFalse
(
result
)
self
.
tic
()
class
TestSlapOSCrmDeleteInstanceTree
(
SlapOSTestCaseMixinWithAbort
):
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
View file @
ee0b13b6
...
...
@@ -364,186 +364,6 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
REQUEST
=
{})
class
TestSlapOSRegularisationRequest_stopInstanceTreeList
(
SlapOSTestCaseMixinWithAbort
):
def
createInstanceTree
(
self
):
new_id
=
self
.
generateNewId
()
instance_tree
=
self
.
portal
.
instance_tree_module
\
.
template_instance_tree
.
Base_createCloneDocument
(
batch_mode
=
1
)
instance_tree
.
edit
(
reference
=
"TESTHS-%s"
%
new_id
,
)
instance_tree
.
validate
()
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
instance_tree
,
'start_requested'
)
return
instance_tree
def
test_stopInstanceTreeList_REQUEST_disallowed
(
self
):
ticket
=
self
.
createRegularisationRequest
()
self
.
assertRaises
(
Unauthorized
,
ticket
.
RegularisationRequest_stopInstanceTreeList
,
'footag'
,
REQUEST
=
{})
@
simulate
(
'InstanceTree_stopFromRegularisationRequest'
,
'person, REQUEST=None'
,
'context.portal_workflow.doActionFor('
\
'context, action="edit_action", '
\
'comment="Visited by InstanceTree_stopFromRegularisationRequest '
\
'%s" % (person))'
)
def
test_stopInstanceTreeList_matching_subscription
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
instance_tree
=
self
.
createInstanceTree
()
ticket
.
edit
(
source_project_value
=
person
,
resource
=
'service_module/slapos_crm_stop_acknowledgement'
,
)
ticket
.
validate
()
ticket
.
suspend
()
instance_tree
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
)
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_stopInstanceTreeList
(
'footag'
)
self
.
assertTrue
(
result
)
self
.
tic
()
self
.
assertEqual
(
'Visited by InstanceTree_stopFromRegularisationRequest '
\
'%s'
%
person
.
getRelativeUrl
(),
instance_tree
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
@
simulate
(
'InstanceTree_stopFromRegularisationRequest'
,
'person, REQUEST=None'
,
'context.portal_workflow.doActionFor('
\
'context, action="edit_action", '
\
'comment="Visited by InstanceTree_stopFromRegularisationRequest '
\
'%s" % (person))'
)
def
test_stopInstanceTreeList_matching_subscription_2
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
instance_tree
=
self
.
createInstanceTree
()
ticket
.
edit
(
source_project_value
=
person
,
resource
=
'service_module/slapos_crm_delete_reminder'
,
)
ticket
.
validate
()
ticket
.
suspend
()
instance_tree
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
)
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_stopInstanceTreeList
(
'footag'
)
self
.
assertTrue
(
result
)
self
.
tic
()
self
.
assertEqual
(
'Visited by InstanceTree_stopFromRegularisationRequest '
\
'%s'
%
person
.
getRelativeUrl
(),
instance_tree
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
@
simulate
(
'InstanceTree_stopFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_stopInstanceTreeList_other_subscription
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
self
.
createInstanceTree
()
ticket
.
edit
(
source_project_value
=
person
,
resource
=
'service_module/slapos_crm_stop_acknowledgement'
,
)
ticket
.
validate
()
ticket
.
suspend
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_stopInstanceTreeList
(
'footag'
)
self
.
assertTrue
(
result
)
self
.
tic
()
@
simulate
(
'InstanceTree_stopFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_stopInstanceTreeList_no_person
(
self
):
ticket
=
self
.
createRegularisationRequest
()
ticket
.
edit
(
resource
=
'service_module/slapos_crm_stop_acknowledgement'
,
)
ticket
.
validate
()
ticket
.
suspend
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_stopInstanceTreeList
(
'footag'
)
self
.
assertFalse
(
result
)
self
.
tic
()
@
simulate
(
'InstanceTree_stopFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_stopInstanceTreeList_not_suspended
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
self
.
createInstanceTree
()
ticket
.
edit
(
source_project_value
=
person
,
resource
=
'service_module/slapos_crm_stop_acknowledgement'
,
)
ticket
.
validate
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_stopInstanceTreeList
(
'footag'
)
self
.
assertFalse
(
result
)
self
.
tic
()
@
simulate
(
'InstanceTree_stopFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_stopInstanceTreeList_other_resource
(
self
):
project
=
self
.
addProject
()
person
=
self
.
makePerson
(
project
,
index
=
0
,
user
=
0
)
ticket
=
self
.
createRegularisationRequest
()
self
.
createInstanceTree
()
ticket
.
edit
(
source_project_value
=
person
,
resource
=
'service_module/slapos_crm_acknowledgement'
,
)
ticket
.
validate
()
ticket
.
suspend
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_stopInstanceTreeList
(
'footag'
)
self
.
assertFalse
(
result
)
self
.
tic
()
class
TestSlapOSInstanceTree_stopFromRegularisationRequest
(
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