Commit 8884d12f authored by Julien Muchembled's avatar Julien Muchembled

TestXHTML: Do not fail too early in test_moduleListMethod and test_*InListbox

* Dead proxy fields are already tested by test_deadProxyFields so other tests
  should ignore them.
* Some fields may have complex TALES that require specific context.
  They should be considered enabled.
* In test_moduleListMethod, list all wrong modules instead of failing on the
  first one.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30006 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5ffe0773
......@@ -132,6 +132,18 @@ class TestXHTML(ERP5TypeTestCase):
self.getPortal().portal_skins.changeSkin(skin_name)
request.set('portal_skin', skin_name)
def getFieldList(self, form, form_path):
try:
for field in form.get_fields(include_disabled=1):
if field.getTemplateField() is not None:
try:
if field.get_value('enabled'):
yield field
except Exception:
yield field
except AttributeError, e:
ZopeTestCase._print("%s is broken: %s" % (form_path, e))
def test_deadProxyFields(self):
# check that all proxy fields defined in business templates have a valid
# target
......@@ -183,11 +195,7 @@ class TestXHTML(ERP5TypeTestCase):
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:
for field in self.getFieldList(form, form_path):
if field.meta_type =='ListBox':
selection_name = field.get_value("selection_name")
if selection_name in ("",None):
......@@ -200,11 +208,7 @@ class TestXHTML(ERP5TypeTestCase):
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:
for field in self.getFieldList(form, form_path):
if field.meta_type == 'ListBox':
list_method = field.get_value("list_method")
if list_method:
......@@ -218,10 +222,12 @@ class TestXHTML(ERP5TypeTestCase):
def test_moduleListMethod(self):
"""Make sure that module's list method works."""
error_list = []
for document in self.portal.contentValues():
if document.portal_type.endswith(' Module'):
ZopeTestCase._print('\n%s.' % document.id)
self.assert_(document.title in document.list(reset=1))
if document.title not in document.list(reset=1):
error_list.append(document.id)
self.assertEqual([], error_list)
def test_preferenceViewDuplication(self):
"""Make sure that preference view is not duplicated."""
......
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