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
Léo-Paul Géneau
slapos.core
Commits
d041e861
Commit
d041e861
authored
Jun 27, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: do not use `transaction` module directly when not necessary
See ERP5 commit 8995b64508f6d7c0fee1ef475de3dc3145ddc84d.
parent
dcdf45e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
master/product/SlapOS/tests/testSlapOSMixin.py
master/product/SlapOS/tests/testSlapOSMixin.py
+7
-10
No files found.
master/product/SlapOS/tests/testSlapOSMixin.py
View file @
d041e861
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
##############################################################################
##############################################################################
import
random
import
random
import
transaction
import
unittest
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
import
functools
import
functools
...
@@ -45,7 +44,7 @@ def withAbort(func):
...
@@ -45,7 +44,7 @@ def withAbort(func):
try
:
try
:
func
(
self
,
*
args
,
**
kwargs
)
func
(
self
,
*
args
,
**
kwargs
)
finally
:
finally
:
transaction
.
abort
()
self
.
abort
()
return
wrapped
return
wrapped
class
testSlapOSMixin
(
ERP5TypeTestCase
):
class
testSlapOSMixin
(
ERP5TypeTestCase
):
...
@@ -66,7 +65,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
...
@@ -66,7 +65,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
self
.
login
()
self
.
login
()
try
:
try
:
alarm
.
activeSense
(
params
=
kwargs
)
alarm
.
activeSense
(
params
=
kwargs
)
transaction
.
commit
()
self
.
commit
()
finally
:
finally
:
setSecurityManager
(
sm
)
setSecurityManager
(
sm
)
return
callAlarm
return
callAlarm
...
@@ -135,7 +134,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
...
@@ -135,7 +134,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
# Reload promise and include yet another bt5 path.
# Reload promise and include yet another bt5 path.
self
.
loadPromise
(
searchable_business_template_list
=
[
"erp5_core"
,
"erp5_base"
,
"slapos_configurator"
])
self
.
loadPromise
(
searchable_business_template_list
=
[
"erp5_core"
,
"erp5_base"
,
"slapos_configurator"
])
self
.
portal
.
portal_alarms
.
promise_template_tool_configuration
.
solve
()
self
.
portal
.
portal_alarms
.
promise_template_tool_configuration
.
solve
()
transaction
.
commit
()
self
.
commit
()
self
.
launchConfigurator
()
self
.
launchConfigurator
()
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
...
@@ -146,7 +145,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
...
@@ -146,7 +145,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
return
return
self
.
portal
.
portal_caches
.
erp5_site_global_id
=
'%s'
%
random
.
random
()
self
.
portal
.
portal_caches
.
erp5_site_global_id
=
'%s'
%
random
.
random
()
self
.
portal
.
portal_caches
.
_p_changed
=
1
self
.
portal
.
portal_caches
.
_p_changed
=
1
transaction
.
commit
()
self
.
commit
()
self
.
portal
.
portal_caches
.
updateCache
()
self
.
portal
.
portal_caches
.
updateCache
()
if
getattr
(
self
.
portal
,
'is_site_bootstrapped'
,
0
):
if
getattr
(
self
.
portal
,
'is_site_bootstrapped'
,
0
):
for
alarm
in
self
.
portal
.
portal_alarms
.
contentValues
():
for
alarm
in
self
.
portal
.
portal_alarms
.
contentValues
():
...
@@ -157,7 +156,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
...
@@ -157,7 +156,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
self
.
portal
.
is_site_bootstrapped
=
1
self
.
portal
.
is_site_bootstrapped
=
1
self
.
bootstrapSite
()
self
.
bootstrapSite
()
self
.
portal
.
_p_changed
=
1
self
.
portal
.
_p_changed
=
1
transaction
.
commit
()
self
.
commit
()
...
@@ -165,7 +164,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
...
@@ -165,7 +164,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
if
'MailHost'
in
self
.
portal
.
objectIds
():
if
'MailHost'
in
self
.
portal
.
objectIds
():
self
.
portal
.
manage_delObjects
([
'MailHost'
])
self
.
portal
.
manage_delObjects
([
'MailHost'
])
self
.
portal
.
manage_addProduct
[
'MailHost'
].
manage_addMailHost
(
'MailHost'
)
self
.
portal
.
manage_addProduct
[
'MailHost'
].
manage_addMailHost
(
'MailHost'
)
transaction
.
commit
()
self
.
commit
()
def
setUpPersistentDummyMailHost
(
self
):
def
setUpPersistentDummyMailHost
(
self
):
if
'MailHost'
in
self
.
portal
.
objectIds
():
if
'MailHost'
in
self
.
portal
.
objectIds
():
...
@@ -189,7 +188,6 @@ class testSlapOSMixin(ERP5TypeTestCase):
...
@@ -189,7 +188,6 @@ class testSlapOSMixin(ERP5TypeTestCase):
response_dict
=
self
.
portal
.
portal_configurator
.
_next
(
response_dict
=
self
.
portal
.
portal_configurator
.
_next
(
business_configuration
,
{})
business_configuration
,
{})
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
self
.
portal
.
portal_configurator
.
startInstallation
(
self
.
portal
.
portal_configurator
.
startInstallation
(
business_configuration
,
REQUEST
=
self
.
portal
.
REQUEST
)
business_configuration
,
REQUEST
=
self
.
portal
.
REQUEST
)
...
@@ -199,7 +197,6 @@ class testSlapOSMixin(ERP5TypeTestCase):
...
@@ -199,7 +197,6 @@ class testSlapOSMixin(ERP5TypeTestCase):
self
.
createCertificateAuthorityFile
()
self
.
createCertificateAuthorityFile
()
self
.
clearCache
()
self
.
clearCache
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
def
getBusinessTemplateList
(
self
):
def
getBusinessTemplateList
(
self
):
...
@@ -244,7 +241,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
...
@@ -244,7 +241,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
self
.
person_user
.
validate
()
self
.
person_user
.
validate
()
for
assignment
in
self
.
person_user
.
contentValues
(
portal_type
=
"Assignment"
):
for
assignment
in
self
.
person_user
.
contentValues
(
portal_type
=
"Assignment"
):
assignment
.
open
()
assignment
.
open
()
transaction
.
commit
()
self
.
commit
()
# prepare part of tree
# prepare part of tree
self
.
hosting_subscription
=
self
.
portal
.
hosting_subscription_module
\
self
.
hosting_subscription
=
self
.
portal
.
hosting_subscription_module
\
.
template_hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
.
template_hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
...
...
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