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
b9dbb9a6
Commit
b9dbb9a6
authored
Sep 29, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: test RegularisationRequest_deleteInstanceTreeList
parent
ee0b13b6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
147 additions
and
158 deletions
+147
-158
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_deleteInstanceTreeList.py
...lapos_crm/RegularisationRequest_deleteInstanceTreeList.py
+2
-2
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
...ateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
+145
-1
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
...ents/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
+0
-155
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm/RegularisationRequest_deleteInstanceTreeList.py
View file @
b9dbb9a6
...
...
@@ -8,12 +8,12 @@ person = ticket.getDestinationDecisionValue(portal_type="Person")
if
(
state
==
'suspended'
)
and
\
(
person
is
not
None
)
and
\
(
ticket
.
getResource
()
==
'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_deleteFromRegularisationRequest'
,
method_args
=
(
person
.
getRelativeUrl
(),),
activate_kw
=
{
'tag'
:
tag
}
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
View file @
b9dbb9a6
...
...
@@ -1033,6 +1033,7 @@ class TestSlapOSCrmDeleteInstanceTree(SlapOSTestCaseMixinWithAbort):
portal_type
=
'Regularisation Request'
,
title
=
"Test Reg. Req.%s"
%
new_id
,
reference
=
"TESTREGREQ-%s"
%
new_id
,
resource
=
'foo/bar'
,
)
#################################################################
...
...
@@ -1059,7 +1060,6 @@ class TestSlapOSCrmDeleteInstanceTree(SlapOSTestCaseMixinWithAbort):
slapos_crm_delete_instance_tree
self
.
_test_alarm_not_visited
(
alarm
,
ticket
,
"RegularisationRequest_deleteInstanceTreeList"
)
def
test_RegularisationRequest_deleteInstanceTreeList_alarm_otherResource
(
self
):
ticket
=
self
.
createRegularisationRequest
()
ticket
.
edit
(
resource
=
'service_module/slapos_crm_delete_reminder'
)
...
...
@@ -1071,6 +1071,150 @@ class TestSlapOSCrmDeleteInstanceTree(SlapOSTestCaseMixinWithAbort):
slapos_crm_delete_instance_tree
self
.
_test_alarm_not_visited
(
alarm
,
ticket
,
"RegularisationRequest_deleteInstanceTreeList"
)
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_deleteInstanceTreeList_script_REQUESTdisallowed
(
self
):
ticket
=
self
.
createRegularisationRequest
()
self
.
assertRaises
(
Unauthorized
,
ticket
.
RegularisationRequest_deleteInstanceTreeList
,
'footag'
,
REQUEST
=
{})
@
simulate
(
'InstanceTree_deleteFromRegularisationRequest'
,
'person, REQUEST=None'
,
'context.portal_workflow.doActionFor('
\
'context, action="edit_action", '
\
'comment="Visited by InstanceTree_deleteFromRegularisationRequest '
\
'%s" % (person))'
)
def
test_RegularisationRequest_deleteInstanceTreeList_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_delete_acknowledgement'
,
)
ticket
.
validate
()
ticket
.
suspend
()
instance_tree
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
)
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_deleteInstanceTreeList
(
'footag'
)
self
.
assertTrue
(
result
)
self
.
tic
()
self
.
assertEqual
(
'Visited by InstanceTree_deleteFromRegularisationRequest '
\
'%s'
%
person
.
getRelativeUrl
(),
instance_tree
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
@
simulate
(
'InstanceTree_deleteFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_RegularisationRequest_deleteInstanceTreeList_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_delete_acknowledgement'
,
)
ticket
.
validate
()
ticket
.
suspend
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_deleteInstanceTreeList
(
'footag'
)
self
.
assertTrue
(
result
)
self
.
tic
()
@
simulate
(
'InstanceTree_deleteFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_RegularisationRequest_deleteInstanceTreeList_script_noPerson
(
self
):
ticket
=
self
.
createRegularisationRequest
()
ticket
.
edit
(
resource
=
'service_module/slapos_crm_delete_acknowledgement'
,
)
ticket
.
validate
()
ticket
.
suspend
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_deleteInstanceTreeList
(
'footag'
)
self
.
assertFalse
(
result
)
self
.
tic
()
@
simulate
(
'InstanceTree_deleteFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_RegularisationRequest_deleteInstanceTreeList_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_delete_acknowledgement'
,
)
ticket
.
validate
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_deleteInstanceTreeList
(
'footag'
)
self
.
assertFalse
(
result
)
self
.
tic
()
@
simulate
(
'InstanceTree_deleteFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_RegularisationRequest_deleteInstanceTreeList_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_delete_reminder'
,
)
ticket
.
validate
()
ticket
.
suspend
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_deleteInstanceTreeList
(
'footag'
)
self
.
assertFalse
(
result
)
self
.
tic
()
class
TestSlapOSCrmMonitoringCheckComputeNodeState
(
SlapOSTestCaseMixinWithAbort
):
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
View file @
b9dbb9a6
...
...
@@ -541,158 +541,3 @@ class TestSlapOSInstanceTree_deleteFromRegularisationRequest(
instance_tree
.
InstanceTree_deleteFromRegularisationRequest
,
'foobar'
)
class
TestSlapOSRegularisationRequest_deleteInstanceTreeList
(
SlapOSTestCaseMixinWithAbort
):
def
createRegularisationRequest
(
self
):
new_id
=
self
.
generateNewId
()
return
self
.
portal
.
regularisation_request_module
.
newContent
(
portal_type
=
'Regularisation Request'
,
title
=
"Test Reg. Req.%s"
%
new_id
,
reference
=
"TESTREGREQ-%s"
%
new_id
,
resource
=
'foo/bar'
,
)
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_deleteInstanceTreeList_REQUEST_disallowed
(
self
):
ticket
=
self
.
createRegularisationRequest
()
self
.
assertRaises
(
Unauthorized
,
ticket
.
RegularisationRequest_deleteInstanceTreeList
,
'footag'
,
REQUEST
=
{})
@
simulate
(
'InstanceTree_deleteFromRegularisationRequest'
,
'person, REQUEST=None'
,
'context.portal_workflow.doActionFor('
\
'context, action="edit_action", '
\
'comment="Visited by InstanceTree_deleteFromRegularisationRequest '
\
'%s" % (person))'
)
def
test_deleteInstanceTreeList_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_delete_acknowledgement'
,
)
ticket
.
validate
()
ticket
.
suspend
()
instance_tree
.
edit
(
destination_section
=
person
.
getRelativeUrl
(),
)
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_deleteInstanceTreeList
(
'footag'
)
self
.
assertTrue
(
result
)
self
.
tic
()
self
.
assertEqual
(
'Visited by InstanceTree_deleteFromRegularisationRequest '
\
'%s'
%
person
.
getRelativeUrl
(),
instance_tree
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
@
simulate
(
'InstanceTree_deleteFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_deleteInstanceTreeList_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_delete_acknowledgement'
,
)
ticket
.
validate
()
ticket
.
suspend
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_deleteInstanceTreeList
(
'footag'
)
self
.
assertTrue
(
result
)
self
.
tic
()
@
simulate
(
'InstanceTree_deleteFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_deleteInstanceTreeList_no_person
(
self
):
ticket
=
self
.
createRegularisationRequest
()
ticket
.
edit
(
resource
=
'service_module/slapos_crm_delete_acknowledgement'
,
)
ticket
.
validate
()
ticket
.
suspend
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_deleteInstanceTreeList
(
'footag'
)
self
.
assertFalse
(
result
)
self
.
tic
()
@
simulate
(
'InstanceTree_deleteFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_deleteInstanceTreeList_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_delete_acknowledgement'
,
)
ticket
.
validate
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_deleteInstanceTreeList
(
'footag'
)
self
.
assertFalse
(
result
)
self
.
tic
()
@
simulate
(
'InstanceTree_deleteFromRegularisationRequest'
,
'*args, **kwargs'
,
'raise NotImplementedError, "Should not have been called"'
)
def
test_deleteInstanceTreeList_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_delete_reminder'
,
)
ticket
.
validate
()
ticket
.
suspend
()
self
.
tic
()
result
=
ticket
.
\
RegularisationRequest_deleteInstanceTreeList
(
'footag'
)
self
.
assertFalse
(
result
)
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