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
0
Merge Requests
0
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
Thomas Gambier
slapos.core
Commits
6425d6ff
Commit
6425d6ff
authored
Sep 26, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: Test ComputeNode_getTicketRelatedList
parent
43d57bc8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
301 additions
and
4 deletions
+301
-4
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_getTicketRelatedList.py
...slapos_crm_monitoring/ComputeNode_getTicketRelatedList.py
+4
-3
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
+297
-1
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_getTicketRelatedList.py
View file @
6425d6ff
...
...
@@ -8,7 +8,8 @@ uid_list = [context.getUid()]
computer_partition_uid_list
=
[
cp
.
getUid
()
for
cp
in
context
.
contentValues
(
portal_type
=
"Compute Partition"
)
if
cp
.
getSlapState
()
==
'busy'
]
for
instance
in
portal
.
portal_catalog
(
if
computer_partition_uid_list
:
for
instance
in
portal
.
portal_catalog
(
portal_type
=
"Software Instance"
,
select_dict
=
{
'specialise_uid'
:
None
},
specialise_portal_type
=
"Instance Tree"
,
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
View file @
6425d6ff
...
...
@@ -156,6 +156,303 @@ class TestSlapOSSupportRequestModule_getMonitoringUrlList(TestCRMSkinsMixin):
self
.
tic
()
self
.
assertNotEqual
(
instance_tree
.
getSuccessorList
(),
[])
class
TestSlapOSComputeNode_getTicketRelatedList
(
TestCRMSkinsMixin
):
def
test_getTicketRelatedList_support_request_related_to_allocated_instance
(
self
):
document
=
self
.
_makeComputeNode
()[
0
]
self
.
_makeComplexComputeNode
()
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
\
title
=
"Test Support Request %s"
%
self
.
new_id
)
ticket
.
setAggregateValue
(
self
.
start_requested_software_instance
.
getSpecialiseValue
())
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
# Not indexed yet
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
self
.
tic
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
ticket
.
submit
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
validate
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
suspend
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
invalidate
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
def
test_getTicketRelatedList_support_request_related_to_compute_node
(
self
):
document
=
self
.
_makeComputeNode
()[
0
]
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
\
title
=
"Test Support Request %s"
%
self
.
new_id
)
ticket
.
setAggregateValue
(
document
)
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
# Not indexed yet
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
self
.
tic
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
ticket
.
submit
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
validate
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
suspend
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
invalidate
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
def
test_getTicketRelatedList_cancelled_support_request_related_to_allocated_instance
(
self
):
document
=
self
.
_makeComputeNode
()[
0
]
self
.
_makeComplexComputeNode
()
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
\
title
=
"Test Support Request %s"
%
self
.
new_id
)
ticket
.
setAggregateValue
(
self
.
start_requested_software_instance
.
getSpecialiseValue
())
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
# Not indexed yet
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
self
.
tic
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
ticket
.
submit
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
cancel
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
def
test_getTicketRelatedList_cancelled_support_request_related_to_compute_node
(
self
):
document
=
self
.
_makeComputeNode
()[
0
]
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
\
title
=
"Test Support Request %s"
%
self
.
new_id
)
ticket
.
setAggregateValue
(
document
)
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
# Not indexed yet
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
self
.
tic
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
ticket
.
submit
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
cancel
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
def
test_getTicketRelatedList_upgrade_decision_related_to_allocated_instance
(
self
):
document
=
self
.
_makeComputeNode
()[
0
]
self
.
_makeComplexComputeNode
()
def
newUpgradeDecision
():
ticket
=
self
.
portal
.
upgrade_decision_module
.
newContent
(
portal_type
=
'Upgrade Decision'
,
title
=
"Upgrade Decision Test %s"
%
self
.
new_id
,
reference
=
"TESTUD-%s"
%
self
.
new_id
)
ticket
.
immediateReindexObject
()
return
ticket
ticket
=
newUpgradeDecision
()
ticket
.
newContent
(
portal_type
=
"Upgrade Decision Line"
).
setAggregateValue
(
self
.
start_requested_software_instance
.
getSpecialiseValue
())
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
# Not indexed yet
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
self
.
tic
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
ticket
.
plan
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
ticket
.
confirm
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
start
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
stop
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
deliver
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
def
test_getTicketRelatedList_upgrade_decision_related_to_compute_node
(
self
):
document
=
self
.
_makeComputeNode
()[
0
]
def
newUpgradeDecision
():
ticket
=
self
.
portal
.
upgrade_decision_module
.
newContent
(
portal_type
=
'Upgrade Decision'
,
title
=
"Upgrade Decision Test %s"
%
self
.
new_id
,
reference
=
"TESTUD-%s"
%
self
.
new_id
)
ticket
.
immediateReindexObject
()
return
ticket
ticket
=
newUpgradeDecision
()
ticket
.
newContent
(
portal_type
=
"Upgrade Decision Line"
).
setAggregateValue
(
document
)
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
# Not indexed yet
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
self
.
tic
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
ticket
.
plan
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
ticket
.
confirm
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
start
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
stop
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
deliver
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
def
test_getTicketRelatedList_cancelled_upgrade_decision_to_allocated_instance
(
self
):
document
=
self
.
_makeComputeNode
()[
0
]
self
.
_makeComplexComputeNode
()
def
newUpgradeDecision
():
ticket
=
self
.
portal
.
upgrade_decision_module
.
newContent
(
portal_type
=
'Upgrade Decision'
,
title
=
"Upgrade Decision Test %s"
%
self
.
new_id
,
reference
=
"TESTUD-%s"
%
self
.
new_id
)
ticket
.
immediateReindexObject
()
return
ticket
ticket
=
newUpgradeDecision
()
ticket
.
newContent
(
portal_type
=
"Upgrade Decision Line"
).
setAggregateValue
(
self
.
start_requested_software_instance
.
getSpecialiseValue
())
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
# Not indexed yet
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
self
.
tic
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
ticket
.
cancel
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
def
test_getTicketRelatedList_cancelled_upgrade_decision_to_computer_node
(
self
):
document
=
self
.
_makeComputeNode
()[
0
]
def
newUpgradeDecision
():
ticket
=
self
.
portal
.
upgrade_decision_module
.
newContent
(
portal_type
=
'Upgrade Decision'
,
title
=
"Upgrade Decision Test %s"
%
self
.
new_id
,
reference
=
"TESTUD-%s"
%
self
.
new_id
)
ticket
.
immediateReindexObject
()
return
ticket
ticket
=
newUpgradeDecision
()
ticket
.
newContent
(
portal_type
=
"Upgrade Decision Line"
).
setAggregateValue
(
document
)
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
# Not indexed yet
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
self
.
tic
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
ticket
.
cancel
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
document
.
ComputeNode_getTicketRelatedList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
class
TestSlapOSBase_getOpenRelatedTicketList
(
TestCRMSkinsMixin
):
def
test_getOpenRelatedTicketList_support_request_related_to_compute_node
(
self
):
...
...
@@ -220,7 +517,6 @@ class TestSlapOSBase_getOpenRelatedTicketList(TestCRMSkinsMixin):
open_related_ticket_list
=
document
.
Base_getOpenRelatedTicketList
()
# Not indexed yet
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
self
.
tic
()
open_related_ticket_list
=
document
.
Base_getOpenRelatedTicketList
()
...
...
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