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
Xavier Thompson
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
Show 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.
import
transaction
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixinWithAbort
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
DateTime
import
DateTime
from
zExceptions
import
Unauthorized
class
TestSlapOSERP5CleanupActiveProcess
(
SlapOSTestCaseMixinWithAbort
):
def
_simulateActiveProcess_deleteSelf
(
self
):
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
check_cleanup_active_process_alarm
(
self
,
date
,
test_method
):
def
verify_getCreationDate_call
(
*
args
,
**
kwargs
):
return
date
ActiveProcessClass
=
self
.
portal
.
portal_types
.
getPortalTypeClass
(
...
...
@@ -44,6 +24,13 @@ context.edit(description=description)""")
)
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._simulateActiveProcess_deleteSelf()
try:
...
...
@@ -56,13 +43,13 @@ context.edit(description=description)""")
assert_method(active_process.getDescription('').
\
endswith("Visited by ActiveProcess_deleteSelf"),
active_process
.
getDescription
(
''
))
active_process.getDescription(''))
"""
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
):
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
):
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5Alarm.xml
View file @
3eeae716
...
...
@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSERP5Alarm
</string>
</value>
...
...
@@ -55,28 +49,13 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<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>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -89,7 +68,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -98,7 +77,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</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