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
fb5912f8
Commit
fb5912f8
authored
Feb 10, 2012
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test which imports a ZODB Document Component from another one.
parent
765722bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
2 deletions
+47
-2
product/ERP5Type/tests/testDynamicClassGeneration.py
product/ERP5Type/tests/testDynamicClassGeneration.py
+47
-2
No files found.
product/ERP5Type/tests/testDynamicClassGeneration.py
View file @
fb5912f8
...
...
@@ -1252,7 +1252,7 @@ class _TestZodbComponent(ERP5TypeTestCase):
except
ImportError
:
pass
else
:
raise
AssertionError
(
"Component '%s' should have been generated"
%
\
raise
AssertionError
(
"Component '%s' should
not
have been generated"
%
\
full_module_name
)
def
assertModuleImportable
(
self
,
module_name
):
...
...
@@ -1262,7 +1262,7 @@ class _TestZodbComponent(ERP5TypeTestCase):
__import__
(
full_module_name
,
fromlist
=
[
self
.
_getComponentModuleName
()],
level
=
0
)
except
ImportError
:
raise
AssertionError
(
"Component '%s' should
not
have been generated"
%
\
raise
AssertionError
(
"Component '%s' should have been generated"
%
\
full_module_name
)
def
testValidateInvalidate
(
self
):
...
...
@@ -1477,6 +1477,51 @@ class TestPortalType(Person):
person_type
.
setTypeClass
(
'Person'
)
transaction
.
commit
()
def
testDocumentWithImport
(
self
):
self
.
failIfModuleImportable
(
'TestDocumentWithImport'
)
self
.
failIfModuleImportable
(
'TestDocumentImported'
)
# Create a new Document Component inheriting from Person Document which
# defines only one additional method (meaningful to make sure that the
# class (and not the module) has been added to the class when the
# TypeClass is changed)
test_imported_component
=
self
.
_newComponent
(
'TestDocumentImported'
,
"""
from Products.ERP5Type.Document.Person import Person
class TestDocumentImported(Person):
def test42(self):
return 42
"""
)
test_component
=
self
.
_newComponent
(
'TestDocumentWithImport'
,
"""
from Products.ERP5.Document.Person import Person
from erp5.component.document.TestDocumentImported import TestDocumentImported
class TestDocumentWithImport(TestDocumentImported):
def test42(self):
return 4242
"""
)
transaction
.
commit
()
self
.
tic
()
self
.
failIfModuleImportable
(
'TestDocumentWithImport'
)
self
.
failIfModuleImportable
(
'TestDocumentImported'
)
test_imported_component
.
validate
()
test_component
.
validate
()
transaction
.
commit
()
self
.
tic
()
# TestPortalWithImport must be imported first to check if
# TestPortalImported could be imported without being present before
self
.
assertModuleImportable
(
'TestDocumentWithImport'
)
self
.
assertModuleImportable
(
'TestDocumentImported'
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestPortalTypeClass
))
...
...
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