Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
d78a2b5b
Commit
d78a2b5b
authored
Sep 01, 2014
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Type tests: make sure to enable developer role when "--save --load" is used
parent
0db06a63
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
15 deletions
+18
-15
product/ERP5Type/tests/ERP5TypeTestCase.py
product/ERP5Type/tests/ERP5TypeTestCase.py
+1
-15
product/ERP5Type/tests/ProcessingNodeTestCase.py
product/ERP5Type/tests/ProcessingNodeTestCase.py
+3
-0
product/ERP5Type/tests/utils.py
product/ERP5Type/tests/utils.py
+14
-0
No files found.
product/ERP5Type/tests/ERP5TypeTestCase.py
View file @
d78a2b5b
...
@@ -61,6 +61,7 @@ from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
...
@@ -61,6 +61,7 @@ from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
from
zLOG
import
LOG
,
DEBUG
from
zLOG
import
LOG
,
DEBUG
from
Products.ERP5Type.tests.backportUnittest
import
SetupSiteError
from
Products.ERP5Type.tests.backportUnittest
import
SetupSiteError
from
Products.ERP5Type.tests.utils
import
addUserToDeveloperRole
from
Products.ERP5Type.tests.utils
import
DummyMailHostMixin
,
parseListeningAddress
from
Products.ERP5Type.tests.utils
import
DummyMailHostMixin
,
parseListeningAddress
# Quiet messages when installing business templates
# Quiet messages when installing business templates
...
@@ -199,21 +200,6 @@ def _parse_args(self, *args, **kw):
...
@@ -199,21 +200,6 @@ def _parse_args(self, *args, **kw):
_parse_args
.
_original
=
DateTime
.
_original_parse_args
_parse_args
.
_original
=
DateTime
.
_original_parse_args
DateTime
.
_parse_args
=
_parse_args
DateTime
.
_parse_args
=
_parse_args
def
addUserToDeveloperRole
(
user_name
):
config
=
getConfiguration
()
product_config
=
getattr
(
config
,
'product_config'
,
None
)
if
product_config
is
None
:
product_config
=
config
.
product_config
=
{}
if
product_config
.
get
(
'erp5'
)
is
None
:
class
DummyDeveloperConfig
(
object
):
pass
dummy_developer_config
=
DummyDeveloperConfig
()
dummy_developer_config
.
developer_list
=
[
user_name
]
product_config
[
'erp5'
]
=
dummy_developer_config
elif
user_name
not
in
product_config
[
'erp5'
].
developer_list
:
product_config
[
'erp5'
].
developer_list
.
append
(
user_name
)
class
ERP5TypeTestCaseMixin
(
ProcessingNodeTestCase
,
PortalTestCase
):
class
ERP5TypeTestCaseMixin
(
ProcessingNodeTestCase
,
PortalTestCase
):
"""Mixin class for ERP5 based tests.
"""Mixin class for ERP5 based tests.
"""
"""
...
...
product/ERP5Type/tests/ProcessingNodeTestCase.py
View file @
d78a2b5b
...
@@ -9,6 +9,7 @@ from ZODB.POSException import ConflictError
...
@@ -9,6 +9,7 @@ from ZODB.POSException import ConflictError
from
zLOG
import
LOG
,
ERROR
from
zLOG
import
LOG
,
ERROR
from
Products.CMFActivity.Activity.Queue
import
VALIDATION_ERROR_DELAY
from
Products.CMFActivity.Activity.Queue
import
VALIDATION_ERROR_DELAY
from
Products.ERP5Type.tests
import
backportUnittest
from
Products.ERP5Type.tests
import
backportUnittest
from
Products.ERP5Type.tests.utils
import
addUserToDeveloperRole
from
Products.ERP5Type.tests.utils
import
createZServer
from
Products.ERP5Type.tests.utils
import
createZServer
...
@@ -256,6 +257,8 @@ class ProcessingNodeTestCase(backportUnittest.TestCase, ZopeTestCase.TestCase):
...
@@ -256,6 +257,8 @@ class ProcessingNodeTestCase(backportUnittest.TestCase, ZopeTestCase.TestCase):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
"""Initialize a node that will only process activities"""
"""Initialize a node that will only process activities"""
self
.
startZServer
()
self
.
startZServer
()
# Make sure to still have possibilities to edit components
addUserToDeveloperRole
(
'ERP5TypeTestCase'
)
from
Zope2.custom_zodb
import
cluster
from
Zope2.custom_zodb
import
cluster
self
.
_registerNode
(
distributing
=
not
cluster
,
processing
=
1
)
self
.
_registerNode
(
distributing
=
not
cluster
,
processing
=
1
)
self
.
commit
()
self
.
commit
()
...
...
product/ERP5Type/tests/utils.py
View file @
d78a2b5b
...
@@ -182,6 +182,20 @@ class DummyLocalizer:
...
@@ -182,6 +182,20 @@ class DummyLocalizer:
# the before traverse hook
# the before traverse hook
pass
pass
def
addUserToDeveloperRole
(
user_name
):
config
=
getConfiguration
()
product_config
=
getattr
(
config
,
'product_config'
,
None
)
if
product_config
is
None
:
product_config
=
config
.
product_config
=
{}
if
product_config
.
get
(
'erp5'
)
is
None
:
class
DummyDeveloperConfig
(
object
):
pass
dummy_developer_config
=
DummyDeveloperConfig
()
dummy_developer_config
.
developer_list
=
[
user_name
]
product_config
[
'erp5'
]
=
dummy_developer_config
elif
user_name
not
in
product_config
[
'erp5'
].
developer_list
:
product_config
[
'erp5'
].
developer_list
.
append
(
user_name
)
# python scripts
# python scripts
def
createZODBPythonScript
(
container
,
script_id
,
script_params
,
def
createZODBPythonScript
(
container
,
script_id
,
script_params
,
...
...
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