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
Lisa Casino
slapos.core
Commits
a8a9ebf5
Commit
a8a9ebf5
authored
Apr 09, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: Update CRM Alarm tests
Changes are related to the usage of monitor_scope definition.
parent
12f26794
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
184 additions
and
13 deletions
+184
-13
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
...ateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
+182
-12
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.xml
...teItem/portal_components/test.erp5.testSlapOSCRMAlarm.xml
+2
-1
No files found.
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
View file @
a8a9ebf5
# Copyright (c) 2013 Nexedi SA and Contributors. All Rights Reserved.
import
transaction
from
erp5.component.test.SlapOSTestCaseMixin
import
\
SlapOSTestCaseMixin
SlapOSTestCaseMixin
,
simulate
from
unittest
import
skip
from
DateTime
import
DateTime
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
...
...
@@ -764,8 +764,10 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def
test_alarm_check_public_computer_state
(
self
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/public'
)
self
.
tic
()
self
.
assertEqual
(
self
.
computer
.
getMonitorScope
(),
"enabled"
)
self
.
_simulateComputer_checkState
()
self
.
tic
()
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_computer_state
.
activeSense
()
...
...
@@ -779,7 +781,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def
test_alarm_check_friend_computer_state
(
self
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/friend'
)
self
.
tic
()
self
.
_simulateComputer_checkState
()
try
:
...
...
@@ -791,12 +793,30 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
self
.
assertEqual
(
'Visited by Computer_checkState'
,
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_check_personal_computer_state
(
self
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/personal'
)
self
.
tic
()
self
.
_simulateComputer_checkState
()
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_computer_state
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropComputer_checkState
()
self
.
assertEqual
(
'Visited by Computer_checkState'
,
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
_test_alarm_check_computer_state_not_selected
(
self
,
allocation_scope
):
def
_test_alarm_check_computer_state_not_selected
(
self
,
allocation_scope
,
monitor_scope
=
None
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
allocation_scope
)
self
.
tic
()
self
.
_simulateComputer_checkState
()
if
monitor_scope
is
not
None
:
self
.
computer
.
edit
(
monitor_scope
=
monitor_scope
)
self
.
tic
()
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_computer_state
.
activeSense
()
...
...
@@ -807,9 +827,20 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
self
.
assertNotEqual
(
'Visited by Computer_checkState'
,
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_check_computer_state_no_public_computer
(
self
):
def
test_alarm_check_computer_state_on_public_computer_with_monitor_scope_disabled
(
self
):
self
.
_test_alarm_check_computer_state_not_selected
(
allocation_scope
=
'open/public'
,
monitor_scope
=
"disabled"
)
def
test_alarm_check_computer_state_on_friend_computer_with_monitor_scope_disabled
(
self
):
self
.
_test_alarm_check_computer_state_not_selected
(
allocation_scope
=
'open/friend'
,
monitor_scope
=
"disabled"
)
def
test_alarm_check_computer_state_on_personal_computer_with_monitor_scope_disabled
(
self
):
self
.
_test_alarm_check_computer_state_not_selected
(
allocation_scope
=
'open/personal'
)
allocation_scope
=
'open/personal'
,
monitor_scope
=
"disabled"
)
def
test_alarm_check_computer_state_closed_forever_computer
(
self
):
self
.
_test_alarm_check_computer_state_not_selected
(
...
...
@@ -883,6 +914,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
self
.
_simulateComputer_checkAndUpdateAllocationScope
()
self
.
tic
()
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_update_allocation_scope
.
activeSense
()
self
.
tic
()
...
...
@@ -945,9 +977,128 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
self
.
assertEqual
(
'Visited by Computer_checkSoftwareInstallationState'
,
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_
not_
run_on_open_personal
(
self
):
def
test_alarm_run_on_open_personal
(
self
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/personal'
)
self
.
computer
.
edit
(
allocation_scope
=
'open/personal'
,
monitor_scope
=
"enabled"
)
self
.
tic
()
self
.
_simulateComputer_checkSoftwareInstallationState
()
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_software_installation_state
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropComputer_checkSoftwareInstallationState
()
self
.
assertEqual
(
'Visited by Computer_checkSoftwareInstallationState'
,
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_dont_run_on_open_public_with_monitor_scope_disabled
(
self
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/public'
)
self
.
tic
()
self
.
computer
.
edit
(
monitor_scope
=
'disabled'
)
self
.
tic
()
self
.
_simulateComputer_checkSoftwareInstallationState
()
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_software_installation_state
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropComputer_checkSoftwareInstallationState
()
self
.
assertNotEqual
(
'Visited by Computer_checkSoftwareInstallationState'
,
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_dont_run_on_open_friend_with_monitor_scope_disabled
(
self
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/friend'
)
self
.
tic
()
self
.
_simulateComputer_checkSoftwareInstallationState
()
self
.
computer
.
edit
(
monitor_scope
=
'disabled'
)
self
.
tic
()
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_software_installation_state
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropComputer_checkSoftwareInstallationState
()
self
.
assertNotEqual
(
'Visited by Computer_checkSoftwareInstallationState'
,
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_dont_run_on_open_personal_with_monitor_scope_disabled
(
self
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/personal'
,
monitor_scope
=
"enabled"
)
self
.
tic
()
self
.
_simulateComputer_checkSoftwareInstallationState
()
self
.
computer
.
edit
(
monitor_scope
=
'disabled'
)
self
.
tic
()
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_software_installation_state
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropComputer_checkSoftwareInstallationState
()
self
.
assertNotEqual
(
'Visited by Computer_checkSoftwareInstallationState'
,
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_not_run_on_close_forever
(
self
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'close/forever'
)
self
.
tic
()
self
.
_simulateComputer_checkSoftwareInstallationState
()
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_software_installation_state
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropComputer_checkSoftwareInstallationState
()
self
.
assertNotEqual
(
'Visited by Computer_checkSoftwareInstallationState'
,
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_not_run_on_close_maintainence
(
self
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'close/maintenence'
)
self
.
tic
()
self
.
_simulateComputer_checkSoftwareInstallationState
()
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_software_installation_state
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropComputer_checkSoftwareInstallationState
()
self
.
assertNotEqual
(
'Visited by Computer_checkSoftwareInstallationState'
,
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_not_run_on_close_outdated
(
self
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'close/outdated'
)
self
.
tic
()
self
.
_simulateComputer_checkSoftwareInstallationState
()
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_software_installation_state
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropComputer_checkSoftwareInstallationState
()
self
.
assertNotEqual
(
'Visited by Computer_checkSoftwareInstallationState'
,
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_not_run_on_close_termination
(
self
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'close/termination'
)
self
.
tic
()
self
.
_simulateComputer_checkSoftwareInstallationState
()
...
...
@@ -998,6 +1149,8 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
original_get_creation
=
Base
.
getCreationDate
Base
.
getCreationDate
=
getCreationDate
self
.
tic
()
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_update_personal_allocation_scope
.
activeSense
()
self
.
tic
()
...
...
@@ -1050,7 +1203,7 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixin):
def
beforeTearDown
(
self
):
transaction
.
abort
()
def
_makeHostingSubscription
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
...
...
@@ -1062,11 +1215,12 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixin):
hosting_subscription
.
edit
(
title
=
"Test hosting sub ticket %s"
%
new_id
,
reference
=
"TESTHST-%s"
%
new_id
,
destination_section_value
=
person
destination_section_value
=
person
,
monitor_scope
=
"enabled"
)
return
hosting_subscription
def
_makeSoftwareInstance
(
self
,
hosting_subscription
):
kw
=
dict
(
...
...
@@ -1101,6 +1255,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by H
def
test_alarm_check_instance_in_error_validated_hosting_subscription
(
self
):
host_sub
=
self
.
_makeHostingSubscription
()
self
.
tic
()
self
.
_simulateHostingSubscription_checkSoftwareInstanceState
()
...
...
@@ -1113,6 +1268,21 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by H
self
.
assertEqual
(
'Visited by HostingSubscription_checkSoftwareInstanceState'
,
host_sub
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_check_instance_in_error_validated_hosting_subscription_with_monitor_disabled
(
self
):
host_sub
=
self
.
_makeHostingSubscription
()
host_sub
.
edit
(
monitor_scope
=
"disabled"
)
self
.
tic
()
self
.
_simulateHostingSubscription_checkSoftwareInstanceState
()
try
:
self
.
portal
.
portal_alarms
.
slapos_crm_check_instance_in_error
.
activeSense
()
self
.
tic
()
finally
:
self
.
_dropHostingSubscription_checkSoftwareInstanceState
()
self
.
assertNotEqual
(
'Visited by HostingSubscription_checkSoftwareInstanceState'
,
host_sub
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_alarm_check_instance_in_error_archived_hosting_subscription
(
self
):
host_sub
=
self
.
_makeHostingSubscription
()
host_sub
.
archive
()
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.xml
View file @
a8a9ebf5
...
...
@@ -46,7 +46,8 @@
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W:1145, 0: Cannot decode using encoding "ascii", unexpected byte at position 32 (invalid-encoded-data)
</string>
<string>
W:1315, 0: Cannot decode using encoding "ascii", unexpected byte at position 32 (invalid-encoded-data)
</string>
<string>
W: 3, 0: Unused simulate imported from erp5.component.test.SlapOSTestCaseMixin (unused-import)
</string>
</tuple>
</value>
</item>
...
...
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