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
alecs_myu
erp5
Commits
aa8ca64a
Commit
aa8ca64a
authored
May 20, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testXHTML: allow creating test methods on any class
This way we can reuse this test in projects code
parent
7b0e4322
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
product/ERP5/tests/testXHTML.py
product/ERP5/tests/testXHTML.py
+10
-8
No files found.
product/ERP5/tests/testXHTML.py
View file @
aa8ca64a
...
...
@@ -560,9 +560,9 @@ def makeTestMethod(validator, module_id, portal_type, view_name, bt_name):
bt_name
=
bt_name
))
return
testMethod
def
testPortalTypeViewRecursivly
(
validator
,
module_id
,
business_template_info
,
business_template_info
_list
,
portal_type_list
,
portal_type_path_dict
,
base_path
,
tested_portal_type_list
):
def
testPortalTypeViewRecursivly
(
test_class
,
validator
,
module_id
,
business_template_info
,
business_template_info_list
,
portal_type_list
,
portal_type_path_dict
,
base_path
,
tested_portal_type_list
):
'''
This function go on all portal_type recursivly if the portal_type could
contain other portal_types and make a test for all view that have action
...
...
@@ -605,7 +605,7 @@ def testPortalTypeViewRecursivly(validator, module_id, business_template_info,
str
(
portal_type
).
replace
(
' '
,
'_'
),
# can be unicode
view_name
))
method
.
__name__
=
method_name
setattr
(
TestXHTML
,
method_name
,
method
)
setattr
(
test_class
,
method_name
,
method
)
module_id
=
backuped_module_id
business_template_info
=
backuped_business_template_info
...
...
@@ -630,7 +630,8 @@ def testPortalTypeViewRecursivly(validator, module_id, business_template_info,
new_portal_type_path_dict
[
pt
]
=
'%s/%s'
%
(
next_base_path
,
pt
)
else
:
new_portal_type_path_dict
[
pt
]
=
pt
testPortalTypeViewRecursivly
(
validator
=
validator
,
testPortalTypeViewRecursivly
(
test_class
=
test_class
,
validator
=
validator
,
module_id
=
module_id
,
business_template_info
=
backuped_business_template_info
,
business_template_info_list
=
business_template_info_list
,
...
...
@@ -639,7 +640,7 @@ def testPortalTypeViewRecursivly(validator, module_id, business_template_info,
base_path
=
next_base_path
,
tested_portal_type_list
=
tested_portal_type_list
)
def
addTestMethodDynamically
(
validator
,
target_business_templates
):
def
addTestMethodDynamically
(
test_class
,
validator
,
target_business_templates
):
from
Products.ERP5.tests.utils
import
BusinessTemplateInfoTar
from
Products.ERP5.tests.utils
import
BusinessTemplateInfoDir
business_template_info_list
=
[]
...
...
@@ -667,7 +668,8 @@ def addTestMethodDynamically(validator, target_business_templates):
business_template_info
.
allowed_content_types
.
get
(
module_portal_type
,
[])
portal_type_path_dict
=
{}
portal_type_path_dict
=
dict
(
map
(
None
,
portal_type_list
,
portal_type_list
))
testPortalTypeViewRecursivly
(
validator
=
validator
,
testPortalTypeViewRecursivly
(
test_class
=
test_class
,
validator
=
validator
,
module_id
=
module_id
,
business_template_info
=
business_template_info
,
business_template_info_list
=
business_template_info_list
,
...
...
@@ -712,7 +714,7 @@ def test_suite():
if
validator
is
not
None
:
# add erp5_core to the list here to not return it
# on getBusinessTemplateList call
addTestMethodDynamically
(
validator
,
addTestMethodDynamically
(
TestXHTML
,
validator
,
(
'erp5_core'
,)
+
TestXHTML
.
getBusinessTemplateList
())
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestXHTML
))
...
...
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