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
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
Carlos Ramos Carreño
erp5
Commits
c906bd1a
Commit
c906bd1a
authored
Oct 05, 2020
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZODB Component: Tool Component: Add Unit Tests.
parent
3f36887b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
1 deletion
+45
-1
product/ERP5Type/tests/testDynamicClassGeneration.py
product/ERP5Type/tests/testDynamicClassGeneration.py
+45
-1
No files found.
product/ERP5Type/tests/testDynamicClassGeneration.py
View file @
c906bd1a
...
...
@@ -2658,7 +2658,7 @@ from Products.ERP5Type.Core.DocumentComponent import DocumentComponent
class
_TestZodbDocumentComponentMixin
(
_TestZodbComponent
):
"""
Common to all Component class inheriting from Document Component (so
Interface and Mixin)
Interface
, Tool
and Mixin)
"""
def
testAtLeastOneClassNamedAfterReference
(
self
):
component
=
self
.
_newComponent
(
...
...
@@ -3025,6 +3025,49 @@ class TestProductsERP5TypeDocumentCompatibility(Base):
from
Products.ERP5Type.Document.TestProductsERP5TypeDocumentCompatibility
import
TestProductsERP5TypeDocumentCompatibility
# pylint:disable=import-error,no-name-in-module
self
.
assertEqual
(
TestProductsERP5TypeDocumentCompatibility
.
generation
,
2
)
from
Products.ERP5Type.Core.ToolComponent
import
ToolComponent
class
TestZodbToolComponent
(
_TestZodbDocumentComponentMixin
):
"""
Tests specific to ZODB Tool Component
"""
_portal_type
=
'Tool Component'
_document_class
=
ToolComponent
def
_getValidSourceCode
(
self
,
class_name
):
return
'''from Products.ERP5Type.Tool.BaseTool import BaseTool
class %(class_name)s(BaseTool):
id = 'portal_%(class_name)s'
portal_type = 'Delivery Tool'
meta_type = 'ERP5 %(meta_type)s'
from Products.ERP5Type.Globals import InitializeClass
InitializeClass(%(class_name)s)
'''
%
dict
(
class_name
=
class_name
,
meta_type
=
''
.
join
([(
c
if
c
.
islower
()
else
' '
+
c
)
for
c
in
class_name
]).
strip
())
def
testHookAfterLoad
(
self
):
component
=
self
.
_newComponent
(
'TestHookAfterLoadTool'
)
self
.
tic
()
response
=
self
.
publish
(
'%s/manage_addProduct/ERP5/manage_addToolForm'
%
self
.
portal
.
getPath
(),
'ERP5TypeTestCase:'
)
self
.
assertEqual
(
response
.
getStatus
(),
200
)
self
.
assertFalse
(
'ERP5 Test Hook After Load Tool'
in
response
.
getBody
())
component
.
validate
()
self
.
tic
()
self
.
assertEqual
(
component
.
getValidationState
(),
'validated'
)
self
.
assertEqual
(
component
.
checkConsistency
(),
[])
self
.
assertEqual
(
component
.
getTextContentErrorMessageList
(),
[])
self
.
assertEqual
(
component
.
getTextContentWarningMessageList
(),
[])
response
=
self
.
publish
(
'%s/manage_addProduct/ERP5/manage_addToolForm'
%
self
.
portal
.
getPath
(),
'ERP5TypeTestCase:'
)
self
.
assertEqual
(
response
.
getStatus
(),
200
)
self
.
assertTrue
(
'ERP5 Test Hook After Load Tool'
in
response
.
getBody
())
from
Products.ERP5Type.Core.TestComponent
import
TestComponent
class
TestZodbTestComponent
(
_TestZodbComponent
):
...
...
@@ -3432,6 +3475,7 @@ def test_suite():
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbPropertySheet
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbExtensionComponent
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbDocumentComponent
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbToolComponent
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbTestComponent
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbInterfaceComponent
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestZodbMixinComponent
))
...
...
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