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
Klaus Wölfel
slapos.core
Commits
bd4001bb
Commit
bd4001bb
authored
Oct 13, 2016
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: fix SupportRequest_updateMonitoringHostingSubscriptionState and add test.
parent
cb2515a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_updateMonitoringHostingSubscriptionState.py
...upportRequest_updateMonitoringHostingSubscriptionState.py
+4
-5
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
+12
-3
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_updateMonitoringHostingSubscriptionState.py
View file @
bd4001bb
...
@@ -4,7 +4,7 @@ import json
...
@@ -4,7 +4,7 @@ import json
from
Products.ERP5Type.DateUtils
import
addToDate
from
Products.ERP5Type.DateUtils
import
addToDate
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
document
=
context
.
get
SourceProject
Value
()
document
=
context
.
get
Aggregate
Value
()
if
document
is
None
:
if
document
is
None
:
return
return
...
@@ -13,7 +13,7 @@ has_error = False
...
@@ -13,7 +13,7 @@ has_error = False
# Check if at least one software Instance is Allocated
# Check if at least one software Instance is Allocated
for
instance
in
document
.
getSpecialiseRelatedValueList
(
for
instance
in
document
.
getSpecialiseRelatedValueList
(
portal_type
=
[
"Software Instance"
,
"Slave Instance"
]):
portal_type
=
[
"Software Instance"
,
"Slave Instance"
]):
if
instance
.
getSlapState
()
not
in
[
"start_requested"
,
"stop_requested"
]:
if
instance
.
getSlapState
()
not
in
[
"start_requested"
,
"stop_requested"
]:
continue
continue
...
@@ -25,7 +25,7 @@ for instance in document.getSpecialiseRelatedValueList(
...
@@ -25,7 +25,7 @@ for instance in document.getSpecialiseRelatedValueList(
else
:
else
:
has_error
=
True
has_error
=
True
break
break
if
not
has_error
:
if
not
has_error
:
person
=
context
.
getDestinationDecision
(
portal_type
=
"Person"
)
person
=
context
.
getDestinationDecision
(
portal_type
=
"Person"
)
if
not
person
:
if
not
person
:
...
@@ -37,8 +37,7 @@ if not has_error:
...
@@ -37,8 +37,7 @@ if not has_error:
return
return
# Send Notification message
# Send Notification message
message
=
""" Suspending this ticket as the problem is not present anymore.
message
=
""" Suspending this ticket as the problem is not present anymore. """
"""
notification_reference
=
"slapos-crm-support-request-suspend-hs-notification"
notification_reference
=
"slapos-crm-support-request-suspend-hs-notification"
notification_message
=
portal
.
portal_notifications
.
getDocumentValue
(
notification_message
=
portal
.
portal_notifications
.
getDocumentValue
(
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
View file @
bd4001bb
...
@@ -8,7 +8,6 @@ from functools import wraps
...
@@ -8,7 +8,6 @@ from functools import wraps
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
import
difflib
import
difflib
import
json
import
json
from
unittest
import
skip
def
simulate
(
script_id
,
params_string
,
code_string
):
def
simulate
(
script_id
,
params_string
,
code_string
):
def
upperWrap
(
f
):
def
upperWrap
(
f
):
...
@@ -3634,7 +3633,6 @@ class TestSupportRequestUpdateMonitoringState(testSlapOSMixin):
...
@@ -3634,7 +3633,6 @@ class TestSupportRequestUpdateMonitoringState(testSlapOSMixin):
support_request
.
SupportRequest_updateMonitoringComputerState
())
support_request
.
SupportRequest_updateMonitoringComputerState
())
self
.
assertEquals
(
support_request
.
getSimulationState
(),
"suspended"
)
self
.
assertEquals
(
support_request
.
getSimulationState
(),
"suspended"
)
@
skip
(
"Missing to finish"
)
@
simulate
(
'SupportRequest_trySendNotificationMessage'
,
@
simulate
(
'SupportRequest_trySendNotificationMessage'
,
"message_title, message, source_relative_url"
,
"message_title, message, source_relative_url"
,
'return "Visited by SupportRequest_trySendNotificationMessage '
\
'return "Visited by SupportRequest_trySendNotificationMessage '
\
...
@@ -3652,8 +3650,18 @@ class TestSupportRequestUpdateMonitoringState(testSlapOSMixin):
...
@@ -3652,8 +3650,18 @@ class TestSupportRequestUpdateMonitoringState(testSlapOSMixin):
support_request
.
SupportRequest_updateMonitoringHostingSubscriptionState
())
support_request
.
SupportRequest_updateMonitoringHostingSubscriptionState
())
support_request
.
setAggregateValue
(
self
.
_makeHostingSubscription
())
support_request
.
setAggregateValue
(
self
.
_makeHostingSubscription
())
self
.
assertEquals
(
None
,
support_request
.
SupportRequest_updateMonitoringHostingSubscriptionState
())
support_request
.
setDestinationDecisionValue
(
self
.
_makePerson
())
support_request
.
setDestinationDecisionValue
(
self
.
_makePerson
())
raise
NotImplementedError
(
"Not implemented yet"
)
self
.
assertEquals
(
"Visited by SupportRequest_trySendNotificationMessage Suspending this ticket as the problem is not present anymore Suspending this ticket as the problem is not present anymore. %s"
%
\
support_request
.
getDestinationDecision
(),
support_request
.
SupportRequest_updateMonitoringHostingSubscriptionState
())
self
.
assertEquals
(
"suspended"
,
support_request
.
getSimulationState
())
@
simulate
(
'SupportRequest_trySendNotificationMessage'
,
@
simulate
(
'SupportRequest_trySendNotificationMessage'
,
"message_title, message, source_relative_url"
,
"message_title, message, source_relative_url"
,
...
@@ -3686,3 +3694,4 @@ class TestSupportRequestUpdateMonitoringState(testSlapOSMixin):
...
@@ -3686,3 +3694,4 @@ class TestSupportRequestUpdateMonitoringState(testSlapOSMixin):
self
.
assertEquals
(
"invalidated"
,
self
.
assertEquals
(
"invalidated"
,
support_request
.
getSimulationState
())
support_request
.
getSimulationState
())
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