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
Paul Graydon
slapos.core
Commits
3eeae716
Commit
3eeae716
authored
Feb 03, 2023
by
Romain Courteaud
Committed by
Rafael Monnerat
Feb 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: stop using createZODBPythonScript
parent
4998d98c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
48 deletions
+14
-48
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5Alarm.py
...teItem/portal_components/test.erp5.testSlapOSERP5Alarm.py
+11
-24
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5Alarm.xml
...eItem/portal_components/test.erp5.testSlapOSERP5Alarm.xml
+3
-24
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5Alarm.py
View file @
3eeae716
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
import
transaction
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
class
TestSlapOSERP5CleanupActiveProcess
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSERP5CleanupActiveProcess
(
SlapOSTestCaseMixinWithAbort
):
def
_simulateActiveProcess_deleteSelf
(
self
):
def
check_cleanup_active_process_alarm
(
self
,
date
,
test_method
):
script_name
=
'ActiveProcess_deleteSelf'
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, **kwargs'
,
'# Script body
\
n
'
"""description = '%s
\
\
nVisited by ActiveProcess_deleteSelf' % context.getDescription()
context.edit(description=description)"""
)
transaction
.
commit
()
def
_dropActiveProcess_deleteSelf
(
self
):
script_name
=
'ActiveProcess_deleteSelf'
if
script_name
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_name
)
transaction
.
commit
()
def
check_cleanup_active_process_alarm
(
self
,
date
,
assert_method
):
def
verify_getCreationDate_call
(
*
args
,
**
kwargs
):
def
verify_getCreationDate_call
(
*
args
,
**
kwargs
):
return
date
return
date
ActiveProcessClass
=
self
.
portal
.
portal_types
.
getPortalTypeClass
(
ActiveProcessClass
=
self
.
portal
.
portal_types
.
getPortalTypeClass
(
...
@@ -44,6 +24,13 @@ context.edit(description=description)""")
...
@@ -44,6 +24,13 @@ context.edit(description=description)""")
)
)
self
.
assertEqual
(
active_process
.
getCreationDate
(),
date
)
self
.
assertEqual
(
active_process
.
getCreationDate
(),
date
)
test_method
(
self
.
portal
.
portal_alarms
.
slapos_erp5_cleanup_active_process
,
active_process
,
'ActiveProcess_deleteSelf'
,
attribute
=
'description'
)
"""
self.tic()
self.tic()
self._simulateActiveProcess_deleteSelf()
self._simulateActiveProcess_deleteSelf()
try:
try:
...
@@ -56,13 +43,13 @@ context.edit(description=description)""")
...
@@ -56,13 +43,13 @@ context.edit(description=description)""")
assert_method(active_process.getDescription('').
\
assert_method(active_process.getDescription('').
\
endswith("Visited by ActiveProcess_deleteSelf"),
endswith("Visited by ActiveProcess_deleteSelf"),
active_process
.
getDescription
(
''
))
active_process.getDescription(''))
"""
def
test_alarm_old_active_process
(
self
):
def
test_alarm_old_active_process
(
self
):
self
.
check_cleanup_active_process_alarm
(
DateTime
()
-
22
,
self
.
assertTrue
)
self
.
check_cleanup_active_process_alarm
(
DateTime
()
-
22
,
self
.
_test_alarm
)
def
test_alarm_new_active_process
(
self
):
def
test_alarm_new_active_process
(
self
):
self
.
check_cleanup_active_process_alarm
(
DateTime
()
-
20
,
self
.
assertFalse
)
self
.
check_cleanup_active_process_alarm
(
DateTime
()
-
20
,
self
.
_test_alarm_not_visited
)
class
TestSlapOSERP5ActiveProcess_deleteSelf
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSERP5ActiveProcess_deleteSelf
(
SlapOSTestCaseMixinWithAbort
):
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5Alarm.xml
View file @
3eeae716
...
@@ -6,12 +6,6 @@
...
@@ -6,12 +6,6 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSERP5Alarm
</string>
</value>
<value>
<string>
testSlapOSERP5Alarm
</string>
</value>
...
@@ -55,28 +49,13 @@
...
@@ -55,28 +49,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -89,7 +68,7 @@
...
@@ -89,7 +68,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -98,7 +77,7 @@
...
@@ -98,7 +77,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</pickle>
...
...
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