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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
01c261fb
Commit
01c261fb
authored
Oct 06, 2020
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZODB Components: Module Component: Add Unit Tests.
parent
ea30cba0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
16 deletions
+14
-16
product/ERP5Type/tests/testDynamicClassGeneration.py
product/ERP5Type/tests/testDynamicClassGeneration.py
+14
-16
No files found.
product/ERP5Type/tests/testDynamicClassGeneration.py
View file @
01c261fb
...
@@ -1429,18 +1429,18 @@ def assertResetCalled(*args, **kwargs):
...
@@ -1429,18 +1429,18 @@ def assertResetCalled(*args, **kwargs):
return
reset_performed
return
reset_performed
import
abc
from
Products.ERP5Type.mixin.component
import
ComponentMixin
from
Products.ERP5Type.mixin.component
import
ComponentMixin
from
Products.ERP5Type.tests.SecurityTestCase
import
SecurityTestCase
from
Products.ERP5Type.tests.SecurityTestCase
import
SecurityTestCase
from
App.config
import
getConfiguration
from
App.config
import
getConfiguration
from
Products.ERP5Type.Core.ModuleComponent
import
ModuleComponent
class
_TestZodb
Component
(
SecurityTestCase
):
class
TestZodbModule
Component
(
SecurityTestCase
):
"""
"""
Abstract class which defined convenient methods used by any Component Tes
t
Tests for ZODB Module Component (base class of all other Componen
t
and tests ran for all Component Test classes
classes)
"""
"""
__metaclass__
=
abc
.
ABCMeta
_portal_type
=
'Module Component'
_document_class
=
ModuleComponent
def
getBusinessTemplateList
(
self
):
def
getBusinessTemplateList
(
self
):
return
(
'erp5_base'
,)
return
(
'erp5_base'
,)
...
@@ -1455,8 +1455,10 @@ class _TestZodbComponent(SecurityTestCase):
...
@@ -1455,8 +1455,10 @@ class _TestZodbComponent(SecurityTestCase):
def
_generateReference
(
self
,
base_name
):
def
_generateReference
(
self
,
base_name
):
return
base_name
return
base_name
def
_getValidSourceCode
(
self
,
class_name
):
def
_getValidSourceCode
(
self
,
*
_
):
raise
NotImplementedError
return
'''def foobar(*args, **kwargs):
return 'Anything'
'''
def
_newComponent
(
self
,
reference
,
text_content
=
None
,
version
=
'erp5'
,
id_
=
None
):
def
_newComponent
(
self
,
reference
,
text_content
=
None
,
version
=
'erp5'
,
id_
=
None
):
"""
"""
...
@@ -2553,7 +2555,7 @@ return 'OK'
...
@@ -2553,7 +2555,7 @@ return 'OK'
from
Products.ERP5Type.Core.ExtensionComponent
import
ExtensionComponent
from
Products.ERP5Type.Core.ExtensionComponent
import
ExtensionComponent
class
TestZodbExtensionComponent
(
_TestZodb
Component
):
class
TestZodbExtensionComponent
(
TestZodbModule
Component
):
"""
"""
Tests specific to ZODB Extension Component (previously defined in bt5 and
Tests specific to ZODB Extension Component (previously defined in bt5 and
installed on the filesystem in $INSTANCE_HOME/Extensions)
installed on the filesystem in $INSTANCE_HOME/Extensions)
...
@@ -2561,11 +2563,6 @@ class TestZodbExtensionComponent(_TestZodbComponent):
...
@@ -2561,11 +2563,6 @@ class TestZodbExtensionComponent(_TestZodbComponent):
_portal_type
=
'Extension Component'
_portal_type
=
'Extension Component'
_document_class
=
ExtensionComponent
_document_class
=
ExtensionComponent
def
_getValidSourceCode
(
self
,
*
_
):
return
'''def foobar(*args, **kwargs):
return 'Anything'
'''
def
testExternalMethod
(
self
):
def
testExternalMethod
(
self
):
"""
"""
Check that ExternalMethod monkey-patch to use ZODB Components works well
Check that ExternalMethod monkey-patch to use ZODB Components works well
...
@@ -2655,7 +2652,7 @@ def foobar(self, a, b="portal_type"):
...
@@ -2655,7 +2652,7 @@ def foobar(self, a, b="portal_type"):
from
Products.ERP5Type.Core.DocumentComponent
import
DocumentComponent
from
Products.ERP5Type.Core.DocumentComponent
import
DocumentComponent
class
_TestZodbDocumentComponentMixin
(
_TestZodb
Component
):
class
_TestZodbDocumentComponentMixin
(
TestZodbModule
Component
):
"""
"""
Common to all Component class inheriting from Document Component (so
Common to all Component class inheriting from Document Component (so
Interface, Tool and Mixin)
Interface, Tool and Mixin)
...
@@ -3070,7 +3067,7 @@ InitializeClass(%(class_name)s)
...
@@ -3070,7 +3067,7 @@ InitializeClass(%(class_name)s)
from
Products.ERP5Type.Core.TestComponent
import
TestComponent
from
Products.ERP5Type.Core.TestComponent
import
TestComponent
class
TestZodbTestComponent
(
_TestZodb
Component
):
class
TestZodbTestComponent
(
TestZodbModule
Component
):
"""
"""
Tests specific to ZODB Test Component (known as Live Tests, and previously
Tests specific to ZODB Test Component (known as Live Tests, and previously
defined in bt5 and installed in $INSTANCE_HOME/test)
defined in bt5 and installed in $INSTANCE_HOME/test)
...
@@ -3473,6 +3470,7 @@ def test_suite():
...
@@ -3473,6 +3470,7 @@ def test_suite():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestPortalTypeClass
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestPortalTypeClass
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbPropertySheet
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbPropertySheet
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbModuleComponent
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbExtensionComponent
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbExtensionComponent
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbDocumentComponent
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbDocumentComponent
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbToolComponent
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbToolComponent
))
...
...
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