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
Ophélie Gagnard
slapos.core
Commits
2c614cd2
Commit
2c614cd2
authored
Mar 27, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: Add tests for slapos_crm_check_software_installation_state
parent
a258f253
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
105 additions
and
74 deletions
+105
-74
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_create_regularisation_request.xml
...ortal_alarms/slapos_crm_create_regularisation_request.xml
+1
-1
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_invalidate_suspended_regularisation_request.xml
...lapos_crm_invalidate_suspended_regularisation_request.xml
+1
-1
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_trigger_acknowledgment_escalation.xml
...l_alarms/slapos_crm_trigger_acknowledgment_escalation.xml
+1
-1
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_trigger_delete_reminder_escalation.xml
..._alarms/slapos_crm_trigger_delete_reminder_escalation.xml
+1
-1
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_trigger_stop_acknowledgment_escalation.xml
...rms/slapos_crm_trigger_stop_acknowledgment_escalation.xml
+1
-1
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_trigger_stop_reminder_escalation.xml
...al_alarms/slapos_crm_trigger_stop_reminder_escalation.xml
+1
-1
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
...ateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
+83
-52
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.xml
...teItem/portal_components/test.erp5.testSlapOSCRMAlarm.xml
+1
-1
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
+15
-15
No files found.
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_create_regularisation_request.xml
View file @
2c614cd2
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
enabled
</string>
</key>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
0
</int>
</value>
<value>
<int>
1
</int>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_invalidate_suspended_regularisation_request.xml
View file @
2c614cd2
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
enabled
</string>
</key>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
0
</int>
</value>
<value>
<int>
1
</int>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_trigger_acknowledgment_escalation.xml
View file @
2c614cd2
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
enabled
</string>
</key>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
0
</int>
</value>
<value>
<int>
1
</int>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_trigger_delete_reminder_escalation.xml
View file @
2c614cd2
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
enabled
</string>
</key>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
0
</int>
</value>
<value>
<int>
1
</int>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_trigger_stop_acknowledgment_escalation.xml
View file @
2c614cd2
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
enabled
</string>
</key>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
0
</int>
</value>
<value>
<int>
1
</int>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_crm/PathTemplateItem/portal_alarms/slapos_crm_trigger_stop_reminder_escalation.xml
View file @
2c614cd2
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
enabled
</string>
</key>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
0
</int>
</value>
<value>
<int>
1
</int>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
View file @
2c614cd2
...
@@ -764,8 +764,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
...
@@ -764,8 +764,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def
test_alarm_check_public_computer_state
(
self
):
def
test_alarm_check_public_computer_state
(
self
):
self
.
_makeComputer
()
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/public'
)
self
.
computer
.
edit
(
allocation_scope
=
'open/public'
)
self
.
tic
()
self
.
_simulateComputer_checkState
()
self
.
_simulateComputer_checkState
()
try
:
try
:
...
@@ -780,7 +779,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
...
@@ -780,7 +779,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def
test_alarm_check_friend_computer_state
(
self
):
def
test_alarm_check_friend_computer_state
(
self
):
self
.
_makeComputer
()
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/friend'
)
self
.
computer
.
edit
(
allocation_scope
=
'open/friend'
)
self
.
tic
()
self
.
_simulateComputer_checkState
()
self
.
_simulateComputer_checkState
()
...
@@ -797,8 +795,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
...
@@ -797,8 +795,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def
_test_alarm_check_computer_state_not_selected
(
self
,
allocation_scope
):
def
_test_alarm_check_computer_state_not_selected
(
self
,
allocation_scope
):
self
.
_makeComputer
()
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
allocation_scope
)
self
.
computer
.
edit
(
allocation_scope
=
allocation_scope
)
self
.
tic
()
self
.
_simulateComputer_checkState
()
self
.
_simulateComputer_checkState
()
try
:
try
:
...
@@ -832,21 +829,6 @@ class TestSlapOSCrmMonitoringCheckComputerAllocationScope(SlapOSTestCaseMixin):
...
@@ -832,21 +829,6 @@ class TestSlapOSCrmMonitoringCheckComputerAllocationScope(SlapOSTestCaseMixin):
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
transaction
.
abort
()
transaction
.
abort
()
def
_makeSoftwareInstallation
(
self
):
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
_simulateComputer_checkAndUpdateAllocationScope
(
self
):
def
_simulateComputer_checkAndUpdateAllocationScope
(
self
):
script_name
=
'Computer_checkAndUpdateAllocationScope'
script_name
=
'Computer_checkAndUpdateAllocationScope'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
...
@@ -858,18 +840,17 @@ class TestSlapOSCrmMonitoringCheckComputerAllocationScope(SlapOSTestCaseMixin):
...
@@ -858,18 +840,17 @@ class TestSlapOSCrmMonitoringCheckComputerAllocationScope(SlapOSTestCaseMixin):
"""portal_workflow = context.portal_workflow
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by Computer_checkAndUpdateAllocationScope') """
)
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by Computer_checkAndUpdateAllocationScope') """
)
transaction
.
commit
()
transaction
.
commit
()
def
_dropComputer_checkAndUpdateAllocationScope
(
self
):
def
_dropComputer_checkAndUpdateAllocationScope
(
self
):
script_name
=
'Computer_checkAndUpdateAllocationScope'
script_name
=
'Computer_checkAndUpdateAllocationScope'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
transaction
.
commit
()
def
test_alarm_not_allowed_allocation_scope_OpenPublic
(
self
):
def
test_alarm_not_allowed_allocation_scope_OpenPublic
(
self
):
self
.
_makeComputer
()
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/public'
)
self
.
computer
.
edit
(
allocation_scope
=
'open/public'
)
self
.
tic
()
self
.
_simulateComputer_checkAndUpdateAllocationScope
()
self
.
_simulateComputer_checkAndUpdateAllocationScope
()
try
:
try
:
...
@@ -884,8 +865,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
...
@@ -884,8 +865,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def
test_alarm_not_allowed_allocation_scope_OpenFriend
(
self
):
def
test_alarm_not_allowed_allocation_scope_OpenFriend
(
self
):
self
.
_makeComputer
()
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/friend'
)
self
.
computer
.
edit
(
allocation_scope
=
'open/friend'
)
self
.
tic
()
self
.
_simulateComputer_checkAndUpdateAllocationScope
()
self
.
_simulateComputer_checkAndUpdateAllocationScope
()
try
:
try
:
...
@@ -900,7 +880,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
...
@@ -900,7 +880,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def
test_alarm_not_allowed_allocationScope_open_personal
(
self
):
def
test_alarm_not_allowed_allocationScope_open_personal
(
self
):
self
.
_makeComputer
()
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/personal'
)
self
.
computer
.
edit
(
allocation_scope
=
'open/personal'
)
self
.
tic
()
self
.
_simulateComputer_checkAndUpdateAllocationScope
()
self
.
_simulateComputer_checkAndUpdateAllocationScope
()
...
@@ -913,27 +892,82 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
...
@@ -913,27 +892,82 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
self
.
assertNotEqual
(
'Visited by Computer_checkAndUpdateAllocationScope'
,
self
.
assertNotEqual
(
'Visited by Computer_checkAndUpdateAllocationScope'
,
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
class
TestSlapOSCrmMonitoringCheckComputerSoftwareInstallation
(
SlapOSTestCaseMixin
):
def
beforeTearDown
(
self
):
transaction
.
abort
()
def
_simulateComputer_checkSoftwareInstallationState
(
self
):
script_name
=
'Computer_checkSoftwareInstallationState'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
raise
ValueError
(
'Precondition failed: %s exists in custom'
%
script_name
)
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
script_name
,
'*args, **kw'
,
'# Script body
\
n
'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by Computer_checkSoftwareInstallationState') """
)
transaction
.
commit
()
def
_dropComputer_checkAndUpdateAllocationScope
(
self
):
script_name
=
'Computer_checkSoftwareInstallationState'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
def
test_alarm_run_on_open_public
(
self
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/public'
)
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_run_on_open_friend
(
self
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/friend'
)
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_not_run_on_open_personal
(
self
):
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'open/personal'
)
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'
])
class
TestSlapOSCrmMonitoringCheckComputerPersonalAllocationScope
(
SlapOSTestCaseMixin
):
class
TestSlapOSCrmMonitoringCheckComputerPersonalAllocationScope
(
SlapOSTestCaseMixin
):
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
transaction
.
abort
()
transaction
.
abort
()
def
_makeSoftwareInstallation
(
self
):
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
_simulateComputer_checkAndUpdatePersonalAllocationScope
(
self
):
def
_simulateComputer_checkAndUpdatePersonalAllocationScope
(
self
):
script_name
=
'Computer_checkAndUpdatePersonalAllocationScope'
script_name
=
'Computer_checkAndUpdatePersonalAllocationScope'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
...
@@ -945,7 +979,7 @@ class TestSlapOSCrmMonitoringCheckComputerPersonalAllocationScope(SlapOSTestCase
...
@@ -945,7 +979,7 @@ class TestSlapOSCrmMonitoringCheckComputerPersonalAllocationScope(SlapOSTestCase
"""portal_workflow = context.portal_workflow
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by Computer_checkAndUpdatePersonalAllocationScope') """
)
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by Computer_checkAndUpdatePersonalAllocationScope') """
)
transaction
.
commit
()
transaction
.
commit
()
def
_dropComputer_checkAndUpdatePersonalAllocationScope
(
self
):
def
_dropComputer_checkAndUpdatePersonalAllocationScope
(
self
):
script_name
=
'Computer_checkAndUpdatePersonalAllocationScope'
script_name
=
'Computer_checkAndUpdatePersonalAllocationScope'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
...
@@ -957,7 +991,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
...
@@ -957,7 +991,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def
getCreationDate
(
self
):
def
getCreationDate
(
self
):
return
DateTime
()
-
31
return
DateTime
()
-
31
self
.
computer
.
edit
(
allocation_scope
=
'open/personal'
)
self
.
computer
.
edit
(
allocation_scope
=
'open/personal'
)
self
.
tic
()
from
Products.ERP5Type.Base
import
Base
from
Products.ERP5Type.Base
import
Base
...
@@ -981,7 +1014,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
...
@@ -981,7 +1014,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def
getCreationDate
(
self
):
def
getCreationDate
(
self
):
return
DateTime
()
-
28
return
DateTime
()
-
28
self
.
computer
.
edit
(
allocation_scope
=
'open/personal'
)
self
.
computer
.
edit
(
allocation_scope
=
'open/personal'
)
self
.
tic
()
from
Products.ERP5Type.Base
import
Base
from
Products.ERP5Type.Base
import
Base
...
@@ -1001,8 +1033,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
...
@@ -1001,8 +1033,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def
test_alarm_allowed_allocation_scope_OpenPersonal_already_closed
(
self
):
def
test_alarm_allowed_allocation_scope_OpenPersonal_already_closed
(
self
):
self
.
_makeComputer
()
self
.
_makeComputer
()
self
.
computer
.
edit
(
allocation_scope
=
'close/outdated'
)
self
.
computer
.
edit
(
allocation_scope
=
'open/oudated'
)
self
.
tic
()
self
.
_simulateComputer_checkAndUpdatePersonalAllocationScope
()
self
.
_simulateComputer_checkAndUpdatePersonalAllocationScope
()
...
@@ -1061,13 +1092,13 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixin):
...
@@ -1061,13 +1092,13 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixin):
"""portal_workflow = context.portal_workflow
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by HostingSubscription_checkSoftwareInstanceState') """
)
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by HostingSubscription_checkSoftwareInstanceState') """
)
transaction
.
commit
()
transaction
.
commit
()
def
_dropHostingSubscription_checkSoftwareInstanceState
(
self
):
def
_dropHostingSubscription_checkSoftwareInstanceState
(
self
):
script_name
=
'HostingSubscription_checkSoftwareInstanceState'
script_name
=
'HostingSubscription_checkSoftwareInstanceState'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
transaction
.
commit
()
def
test_alarm_check_instance_in_error_validated_hosting_subscription
(
self
):
def
test_alarm_check_instance_in_error_validated_hosting_subscription
(
self
):
host_sub
=
self
.
_makeHostingSubscription
()
host_sub
=
self
.
_makeHostingSubscription
()
...
@@ -1101,7 +1132,7 @@ class TestSlaposCrmUpdateSupportRequestState(SlapOSTestCaseMixin):
...
@@ -1101,7 +1132,7 @@ class TestSlaposCrmUpdateSupportRequestState(SlapOSTestCaseMixin):
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
transaction
.
abort
()
transaction
.
abort
()
def
_makeSupportRequest
(
self
):
def
_makeSupportRequest
(
self
):
person
=
self
.
portal
.
person_module
.
template_member
\
person
=
self
.
portal
.
person_module
.
template_member
\
.
Base_createCloneDocument
(
batch_mode
=
1
)
.
Base_createCloneDocument
(
batch_mode
=
1
)
...
@@ -1130,13 +1161,13 @@ class TestSlaposCrmUpdateSupportRequestState(SlapOSTestCaseMixin):
...
@@ -1130,13 +1161,13 @@ class TestSlaposCrmUpdateSupportRequestState(SlapOSTestCaseMixin):
"""portal_workflow = context.portal_workflow
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by SupportRequest_updateMonitoringState') """
)
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by SupportRequest_updateMonitoringState') """
)
transaction
.
commit
()
transaction
.
commit
()
def
_dropSupportRequest_updateMonitoringState
(
self
):
def
_dropSupportRequest_updateMonitoringState
(
self
):
script_name
=
'SupportRequest_updateMonitoringState'
script_name
=
'SupportRequest_updateMonitoringState'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
transaction
.
commit
()
def
test_alarm_update_support_request_state
(
self
):
def
test_alarm_update_support_request_state
(
self
):
support_request
=
self
.
_makeSupportRequest
()
support_request
=
self
.
_makeSupportRequest
()
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.xml
View file @
2c614cd2
...
@@ -46,7 +46,7 @@
...
@@ -46,7 +46,7 @@
<key>
<string>
text_content_warning_message
</string>
</key>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<value>
<tuple>
<tuple>
<string>
W:11
0
5, 0: Cannot decode using encoding "ascii", unexpected byte at position 32 (invalid-encoded-data)
</string>
<string>
W:11
4
5, 0: Cannot decode using encoding "ascii", unexpected byte at position 32 (invalid-encoded-data)
</string>
</tuple>
</tuple>
</value>
</value>
</item>
</item>
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
View file @
2c614cd2
...
@@ -434,8 +434,8 @@ The slapos team
...
@@ -434,8 +434,8 @@ The slapos team
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
transaction
.
commit
()
transaction
.
commit
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
self
.
assertNotEqual
(
ticket
,
None
)
self
.
assertNotEqual
s
(
ticket
,
None
)
self
.
assertNotEqual
(
event
,
None
)
self
.
assertNotEqual
s
(
event
,
None
)
self
.
assertEqual
(
ticket2
,
None
)
self
.
assertEqual
(
ticket2
,
None
)
self
.
assertEqual
(
event2
,
None
)
self
.
assertEqual
(
event2
,
None
)
...
@@ -456,8 +456,8 @@ The slapos team
...
@@ -456,8 +456,8 @@ The slapos team
transaction
.
commit
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
self
.
assertNotEqual
(
ticket
,
None
)
self
.
assertNotEqual
s
(
ticket
,
None
)
self
.
assertNotEqual
(
event
,
None
)
self
.
assertNotEqual
s
(
event
,
None
)
self
.
assertEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertEqual
(
event2
,
None
)
self
.
assertEqual
(
event2
,
None
)
...
@@ -469,8 +469,8 @@ The slapos team
...
@@ -469,8 +469,8 @@ The slapos team
transaction
.
commit
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
self
.
assertNotEqual
(
ticket
,
None
)
self
.
assertNotEqual
s
(
ticket
,
None
)
self
.
assertNotEqual
(
event
,
None
)
self
.
assertNotEqual
s
(
event
,
None
)
self
.
assertEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertEqual
(
event2
,
None
)
self
.
assertEqual
(
event2
,
None
)
...
@@ -482,8 +482,8 @@ The slapos team
...
@@ -482,8 +482,8 @@ The slapos team
transaction
.
commit
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
self
.
assertNotEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertNotEqual
s
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertNotEqual
(
event2
,
None
)
self
.
assertNotEqual
s
(
event2
,
None
)
def
test_addRegularisationRequest_REQUEST_disallowed
(
self
):
def
test_addRegularisationRequest_REQUEST_disallowed
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
...
@@ -634,7 +634,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
...
@@ -634,7 +634,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
'service_module/slapos_crm_spam'
,
'foo2 title'
,
'foo2 content'
,
'foo2 comment'
)
'service_module/slapos_crm_spam'
,
'foo2 title'
,
'foo2 content'
,
'foo2 comment'
)
self
.
assertEqual
(
ticket
.
getResource
(),
'foo/bar'
)
self
.
assertEqual
(
ticket
.
getResource
(),
'foo/bar'
)
self
.
assertNotEqual
(
event
.
getTitle
(),
'foo2 title'
)
self
.
assertNotEqual
s
(
event
.
getTitle
(),
'foo2 title'
)
self
.
assertEqual
(
event
.
getTextContent
(),
None
)
self
.
assertEqual
(
event
.
getTextContent
(),
None
)
self
.
assertEqual
(
event
.
getSimulationState
(),
'draft'
)
self
.
assertEqual
(
event
.
getSimulationState
(),
'draft'
)
self
.
assertEqual
(
event
.
getRelativeUrl
(),
event2
.
getRelativeUrl
())
self
.
assertEqual
(
event
.
getRelativeUrl
(),
event2
.
getRelativeUrl
())
...
@@ -666,7 +666,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
...
@@ -666,7 +666,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
transaction
.
commit
()
transaction
.
commit
()
event2
=
ticket
.
RegularisationRequest_checkToSendUniqEvent
(
event2
=
ticket
.
RegularisationRequest_checkToSendUniqEvent
(
'service_module/slapos_crm_spam'
,
'foo2 title'
,
'foo2 content'
,
'foo2 comment'
)
'service_module/slapos_crm_spam'
,
'foo2 title'
,
'foo2 content'
,
'foo2 comment'
)
self
.
assertNotEqual
(
event
,
event2
)
self
.
assertNotEqual
s
(
event
,
event2
)
self
.
assertEqual
(
event2
,
None
)
self
.
assertEqual
(
event2
,
None
)
def
test_checkToSendUniqEvent_REQUEST_disallowed
(
self
):
def
test_checkToSendUniqEvent_REQUEST_disallowed
(
self
):
...
@@ -1956,7 +1956,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
...
@@ -1956,7 +1956,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
computer
.
getAllocationScope
(),
'open/personal'
)
self
.
assertEqual
(
computer
.
getAllocationScope
(),
'open/personal'
)
#ticket = self._getGeneratedSupportRequest(computer)
#ticket = self._getGeneratedSupportRequest(computer)
self
.
assertNotEqual
(
None
,
ticket
)
self
.
assertNotEqual
s
(
None
,
ticket
)
self
.
assertEqual
(
ticket
.
getSimulationState
(),
'suspended'
)
self
.
assertEqual
(
ticket
.
getSimulationState
(),
'suspended'
)
self
.
assertEqual
(
'Visited by SupportRequest_trySendNotificationMessage '
\
self
.
assertEqual
(
'Visited by SupportRequest_trySendNotificationMessage '
\
...
@@ -3116,7 +3116,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
...
@@ -3116,7 +3116,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
self
.
assertEqual
(
title
,
first_event
.
getTitle
())
self
.
assertEqual
(
title
,
first_event
.
getTitle
())
self
.
assertEqual
(
text_content
,
first_event
.
getTextContent
())
self
.
assertEqual
(
text_content
,
first_event
.
getTextContent
())
self
.
assertNotEqual
(
None
,
first_event
.
getStartDate
())
self
.
assertNotEqual
s
(
None
,
first_event
.
getStartDate
())
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
first_event
.
getResource
())
first_event
.
getResource
())
self
.
assertEqual
(
first_event
.
getDestination
(),
person
.
getRelativeUrl
())
self
.
assertEqual
(
first_event
.
getDestination
(),
person
.
getRelativeUrl
())
...
@@ -3130,7 +3130,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
...
@@ -3130,7 +3130,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
self
.
assertEqual
(
title
,
event
.
getTitle
())
self
.
assertEqual
(
title
,
event
.
getTitle
())
self
.
assertEqual
(
text_content
,
event
.
getTextContent
())
self
.
assertEqual
(
text_content
,
event
.
getTextContent
())
self
.
assertNotEqual
(
None
,
event
.
getStartDate
())
self
.
assertNotEqual
s
(
None
,
event
.
getStartDate
())
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
event
.
getResource
())
event
.
getResource
())
self
.
assertEqual
(
event
.
getDestination
(),
person
.
getRelativeUrl
())
self
.
assertEqual
(
event
.
getDestination
(),
person
.
getRelativeUrl
())
...
@@ -3143,7 +3143,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
...
@@ -3143,7 +3143,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
self
.
assertEqual
(
event
.
getTitle
(),
title
)
self
.
assertEqual
(
event
.
getTitle
(),
title
)
self
.
assertEqual
(
text_content
,
event
.
getTextContent
())
self
.
assertEqual
(
text_content
,
event
.
getTextContent
())
self
.
assertNotEqual
(
None
,
event
.
getStartDate
())
self
.
assertNotEqual
s
(
None
,
event
.
getStartDate
())
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
event
.
getResource
())
event
.
getResource
())
self
.
assertEqual
(
event
.
getDestination
(),
person
.
getRelativeUrl
())
self
.
assertEqual
(
event
.
getDestination
(),
person
.
getRelativeUrl
())
...
@@ -3168,7 +3168,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
...
@@ -3168,7 +3168,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
self
.
assertEqual
(
title
,
another_first_event
.
getTitle
())
self
.
assertEqual
(
title
,
another_first_event
.
getTitle
())
self
.
assertEqual
(
text_content
,
another_first_event
.
getTextContent
())
self
.
assertEqual
(
text_content
,
another_first_event
.
getTextContent
())
self
.
assertNotEqual
(
None
,
another_first_event
.
getStartDate
())
self
.
assertNotEqual
s
(
None
,
another_first_event
.
getStartDate
())
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
another_first_event
.
getResource
())
another_first_event
.
getResource
())
self
.
assertEqual
(
another_first_event
.
getDestination
(),
person
.
getRelativeUrl
())
self
.
assertEqual
(
another_first_event
.
getDestination
(),
person
.
getRelativeUrl
())
...
...
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