Commit b870faab authored by Gabriel Monnerat's avatar Gabriel Monnerat

Fix test to interact in all Business Templates to find actions and allowed content types

parent b8ef41df
...@@ -575,32 +575,35 @@ def testPortalTypeViewRecursivly(test_class, validator, module_id, ...@@ -575,32 +575,35 @@ def testPortalTypeViewRecursivly(test_class, validator, module_id,
break break
# create the object in portal_trash module # create the object in portal_trash module
module_id = 'portal_trash' module_id = 'portal_trash'
for business_template_info in business_template_info_list:
for action_information in business_template_info.actions[portal_type]: if portal_type not in business_template_info.actions:
if (action_information['category'] in ('object_view', 'object_list') and continue
action_information['visible']==1 and for action_information in business_template_info.actions[portal_type]:
action_information['text'].startswith('string:${object_url}/') and if (action_information['category'] in ('object_view', 'object_list') and
len(action_information['text'].split('/'))==2): action_information['visible']==1 and
view_name = action_information['text'].split('/')[-1].split('?')[0] action_information['action'].startswith('string:${object_url}/') and
method = makeTestMethod(validator, len(action_information['action'].split('/'))==2):
module_id, view_name = action_information['action'].split('/')[-1].split('?')[0]
portal_path, method = makeTestMethod(validator,
view_name, module_id,
business_template_info.title) portal_path,
method_name = ('test_%s_%s_%s' % view_name,
(business_template_info.title, business_template_info.title)
str(portal_type).replace(' ','_'), # can be unicode method_name = ('test_%s_%s_%s' %
view_name)) (business_template_info.title,
method.__name__ = method_name str(portal_type).replace(' ','_'), # can be unicode
setattr(test_class, method_name, method) view_name))
module_id = backuped_module_id method.__name__ = method_name
business_template_info = backuped_business_template_info setattr(test_class, method_name, method)
module_id = backuped_module_id
# add the portal_type to the tested portal_types. This avoid to test many # add the portal_type to the tested portal_types. This avoid to test many
# times a Portal Type wich is many bt. # times a Portal Type wich is many bt.
tested_portal_type_list.append(portal_type) tested_portal_type_list.append(portal_type)
new_portal_type_list = business_template_info.allowed_content_types.get(portal_type, ()) new_portal_type_list = []
for tmp_business_template_info in business_template_info_list:
new_portal_type_list.extend(tmp_business_template_info.allowed_content_types.get(portal_type, ()))
new_portal_type_path_dict = {} new_portal_type_path_dict = {}
if base_path != '': if base_path != '':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment