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
8ca0f757
Commit
8ca0f757
authored
Aug 20, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: Don't display cancelled Upgrade decisions
parent
33d31f69
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
206 additions
and
48 deletions
+206
-48
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Base_getOpenRelatedTicketList.py
...ns/slapos_crm_monitoring/Base_getOpenRelatedTicketList.py
+2
-1
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
+204
-47
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Base_getOpenRelatedTicketList.py
View file @
8ca0f757
...
...
@@ -24,6 +24,7 @@ if 'limit' not in kw:
result_list
=
[]
for
document
in
portal
.
portal_catalog
(
query
=
query
,
**
kw
):
if
document
.
getPortalType
()
==
"Upgrade Decision Line"
:
if
document
.
getParentValue
().
getSimulationState
()
!=
'cancelled'
:
result_list
.
append
(
document
.
getParentValue
())
continue
result_list
.
append
(
document
)
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
View file @
8ca0f757
...
...
@@ -54,6 +54,53 @@ class TestCRMSkinsMixin(SlapOSTestCaseMixinWithAbort):
assignment
.
open
()
return
assignment
def
_makeHostingSubscription
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
=
self
.
portal
\
.
hosting_subscription_module
.
template_hosting_subscription
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
.
validate
()
new_id
=
self
.
generateNewId
()
hosting_subscription
.
edit
(
title
=
"Test hosting sub ticket %s"
%
new_id
,
reference
=
"TESTHST-%s"
%
new_id
,
destination_section_value
=
person
)
return
hosting_subscription
def
_makeSoftwareInstance
(
self
,
hosting_subscription
,
software_url
):
kw
=
dict
(
software_release
=
software_url
,
software_type
=
self
.
generateNewSoftwareType
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
hosting_subscription
.
getTitle
(),
state
=
'started'
)
hosting_subscription
.
requestStart
(
**
kw
)
hosting_subscription
.
requestInstance
(
**
kw
)
def
_makeSoftwareInstallation
(
self
):
self
.
_makeComputer
()
software_installation
=
self
.
portal
\
.
software_installation_module
.
template_software_installation
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
software_installation
.
edit
(
url_string
=
self
.
generateNewSoftwareReleaseUrl
(),
aggregate
=
self
.
computer
.
getRelativeUrl
(),
reference
=
'TESTSOFTINSTS-%s'
%
self
.
generateNewId
(),
title
=
'Start requested for %s'
%
self
.
computer
.
getUid
()
)
software_installation
.
validate
()
software_installation
.
requestStart
()
return
software_installation
class
TestSlapOSFolder_getOpenTicketList
(
TestCRMSkinsMixin
):
def
_test_ticket
(
self
,
ticket
,
expected_amount
):
...
...
@@ -166,6 +213,163 @@ class TestSlapOSFolder_getOpenTicketList(TestCRMSkinsMixin):
ticket
=
newUpgradeDecision
()
self
.
_test_upgrade_decision
(
ticket
,
2
)
class
TestSlapOSBase_getOpenRelatedTicketList
(
TestCRMSkinsMixin
):
def
test_support_request_related_to_computer
(
self
):
computer
=
self
.
_makeComputer
()[
0
]
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
\
title
=
"Test Support Request %s"
%
self
.
new_id
)
ticket
.
setAggregateValue
(
computer
)
open_related_ticket_list
=
computer
.
Base_getOpenRelatedTicketList
()
# Not indexed yet
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
self
.
tic
()
open_related_ticket_list
=
computer
.
Base_getOpenRelatedTicketList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
submit
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
computer
.
Base_getOpenRelatedTicketList
()
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
=
computer
.
Base_getOpenRelatedTicketList
()
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
=
computer
.
Base_getOpenRelatedTicketList
()
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
=
computer
.
Base_getOpenRelatedTicketList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
def
test_cancelled_support_request_related_to_computer
(
self
):
computer
=
self
.
_makeComputer
()[
0
]
ticket
=
self
.
portal
.
support_request_module
.
newContent
(
\
title
=
"Test Support Request %s"
%
self
.
new_id
)
ticket
.
setAggregateValue
(
computer
)
open_related_ticket_list
=
computer
.
Base_getOpenRelatedTicketList
()
# Not indexed yet
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
self
.
tic
()
open_related_ticket_list
=
computer
.
Base_getOpenRelatedTicketList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
submit
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
computer
.
Base_getOpenRelatedTicketList
()
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
=
computer
.
Base_getOpenRelatedTicketList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
def
test_upgrade_decision_related_to_computer
(
self
):
computer
=
self
.
_makeComputer
()[
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
(
computer
)
open_related_ticket_list
=
computer
.
Base_getOpenRelatedTicketList
()
# Not indexed yet
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
self
.
tic
()
open_related_ticket_list
=
computer
.
Base_getOpenRelatedTicketList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
plan
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
computer
.
Base_getOpenRelatedTicketList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
ticket
.
confirm
()
ticket
.
immediateReindexObject
()
open_related_ticket_list
=
computer
.
Base_getOpenRelatedTicketList
()
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
=
computer
.
Base_getOpenRelatedTicketList
()
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
=
computer
.
Base_getOpenRelatedTicketList
()
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
=
computer
.
Base_getOpenRelatedTicketList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
1
)
self
.
assertEqual
(
open_related_ticket_list
[
0
].
getUid
(),
ticket
.
getUid
())
def
test_cancelled_upgrade_decision_related_to_computer
(
self
):
computer
=
self
.
_makeComputer
()[
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
(
computer
)
open_related_ticket_list
=
computer
.
Base_getOpenRelatedTicketList
()
# Not indexed yet
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
self
.
tic
()
open_related_ticket_list
=
computer
.
Base_getOpenRelatedTicketList
()
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
=
computer
.
Base_getOpenRelatedTicketList
()
self
.
assertEqual
(
len
(
open_related_ticket_list
),
0
)
class
TestSlapOSTicketEvent
(
TestCRMSkinsMixin
):
def
_test_event
(
self
,
ticket
):
...
...
@@ -724,37 +928,6 @@ class TestSlapOSGenerateSupportRequestForSlapOS(TestCRMSkinsMixin):
self
.
tic
()
self
.
_cancelTestSupportRequestList
()
def
_makeHostingSubscription
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
=
self
.
portal
\
.
hosting_subscription_module
.
template_hosting_subscription
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
.
validate
()
new_id
=
self
.
generateNewId
()
hosting_subscription
.
edit
(
title
=
"Test hosting sub ticket %s"
%
new_id
,
reference
=
"TESTHST-%s"
%
new_id
,
destination_section_value
=
person
)
return
hosting_subscription
def
_makeSoftwareInstance
(
self
,
hosting_subscription
,
software_url
):
kw
=
dict
(
software_release
=
software_url
,
software_type
=
self
.
generateNewSoftwareType
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
hosting_subscription
.
getTitle
(),
state
=
'started'
)
hosting_subscription
.
requestStart
(
**
kw
)
hosting_subscription
.
requestInstance
(
**
kw
)
def
_makeComputer
(
self
):
SlapOSTestCaseMixin
.
_makeComputer
(
self
)
# Clone computer document
...
...
@@ -763,22 +936,6 @@ class TestSlapOSGenerateSupportRequestForSlapOS(TestCRMSkinsMixin):
)
return
self
.
computer
def
_makeSoftwareInstallation
(
self
):
self
.
_makeComputer
()
software_installation
=
self
.
portal
\
.
software_installation_module
.
template_software_installation
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
software_installation
.
edit
(
url_string
=
self
.
generateNewSoftwareReleaseUrl
(),
aggregate
=
self
.
computer
.
getRelativeUrl
(),
reference
=
'TESTSOFTINSTS-%s'
%
self
.
generateNewId
(),
title
=
'Start requested for %s'
%
self
.
computer
.
getUid
()
)
software_installation
.
validate
()
software_installation
.
requestStart
()
return
software_installation
def
test_computer_Base_generateSupportRequestForSlapOS
(
self
):
self
.
_makeComputer
()
title
=
"Test Support Request %s"
%
self
.
computer
.
getReference
()
...
...
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