Commit 105a2ed7 authored by Nicolas Delaby's avatar Nicolas Delaby

Test that all listboxes have a callable ListMethod

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26912 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6baf5063
# -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Copyright (c) 2007 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2007 Nexedi SARL and Contributors. All Rights Reserved.
...@@ -159,6 +160,28 @@ class TestXHTML(ERP5TypeTestCase): ...@@ -159,6 +160,28 @@ class TestXHTML(ERP5TypeTestCase):
error_list.append(form_path) error_list.append(form_path)
self.assertEquals(error_list, []) self.assertEquals(error_list, [])
def test_executableListMethodInListbox(self):
# check all list_method in listboxes
skins_tool = self.portal.portal_skins
error_list = []
for form_path, form in skins_tool.ZopeFind(
skins_tool, obj_metatypes=['ERP5 Form'], search_sub=1):
try:
fields = form.get_fields()
except AttributeError, e:
print "%s is broken: %s" % (form_path, e)
for field in fields:
if field.meta_type == 'ListBox':
list_method = field.get_value("list_method")
if list_method:
if isinstance(list_method, str):
method = getattr(self.portal, list_method)
else:
method = list_method
if not callable(method):
error_list.append(form_path)
self.assertEquals(error_list, [])
class W3Validator(object): class W3Validator(object):
def __init__(self, validator_path, show_warnings): def __init__(self, validator_path, show_warnings):
......
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