Commit f52d42e5 authored by Julien Muchembled's avatar Julien Muchembled

* DocumentationHelper:

  * Fix test_01_ERP5Site unit test.
  * Remove useless getBusinessTemplateIdList.
  * Clean up getBusinessTemplateItemList.
* Fix non utf8 char in comment.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23176 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ca318955
......@@ -80,36 +80,17 @@ class ERP5SiteDocumentationHelper(DocumentationHelper):
"""
return getattr(self.getDocumentedObject(), "description", '')
security.declareProtected( Permissions.AccessContentsInformation, 'getBusinessTemplateIdList' )
def getBusinessTemplateIdList(self):
"""
"""
bt_list = []
for bt in self.getDocumentedObject().portal_templates.objectValues():
current_state = ''
if bt.getInstallationState() == 'installed':
bt_list.append(bt.getId())
return bt_list
security.declareProtected( Permissions.AccessContentsInformation, 'getBusinessTemplateItemList' )
def getBusinessTemplateItemList(self):
"""
"""
bt_list = []
portal_templates = getattr(self.getDocumentedObject(), "portal_templates", None)
if portal_templates is not None:
for bt in portal_templates.objectValues():
current_state = ''
for wh in bt.workflow_history['business_template_installation_workflow']:
current_state = wh['installation_state']
if current_state == 'installed':
bt_list.append((bt.getId(),
getattr(bt, "title", ''),
getattr(bt, "description", ''),
getattr(bt, "version", ''),
getattr(bt, "revision", '')
))
return bt_list
return [(bt.getId(),
getattr(bt, "title", ''),
getattr(bt, "description", ''),
getattr(bt, "version", ''),
getattr(bt, "revision", ''))
for bt in self.getDocumentedObject().portal_templates.objectValues()
if bt.getInstallationState() == 'installed']
security.declareProtected( Permissions.AccessContentsInformation, 'getBusinessTemplateURIList' )
def getBusinessTemplateURIList(self):
......
......@@ -56,11 +56,7 @@ class TestDocumentationHelper(ERP5TypeTestCase):
def getBusinessTemplateList(self):
"""return list of business templates to be installed. """
return ( 'erp5_documentation',
'erp5_core',
'erp5_xhtml_style',
'erp5_ui_test',
)
return 'erp5_documentation', 'erp5_ui_test'
def test_01_ERP5Site(self):
ZopeTestCase._print('\nTest Documentation ERP5Site')
......@@ -68,13 +64,9 @@ class TestDocumentationHelper(ERP5TypeTestCase):
site_uri = self.portal.getUrl()
site_do = ERP5SiteDocumentationHelper(site_uri).__of__(self.portal)
self.assertEquals(len(site_do.getSectionList()), 1)
#just erp5_core, erp5_mysql_innodb_catalog, erp5_documentation
#, erp5_xhtml_style and erp5_ui_test are installed
self.assertTrue('erp5_core' in site_do.getBusinessTemplateIdList())
self.assertTrue('erp5_xhtml_style' in site_do.getBusinessTemplateIdList())
self.assertTrue('erp5_mysql_innodb_catalog' in site_do.getBusinessTemplateIdList())
self.assertTrue('erp5_documentation' in site_do.getBusinessTemplateIdList())
self.assertTrue('erp5_ui_test' in site_do.getBusinessTemplateIdList())
bt_title_set = set(bt[1] for bt in site_do.getBusinessTemplateItemList())
self.assertTrue('erp5_core' in bt_title_set)
self.assertTrue('erp5_documentation' in bt_title_set)
self.portal.portal_classes.getDocumentationHelper(
'ERP5SiteDocumentationHelper', site_uri).view()
#test the report mode of the documentation of the whole site
......
......@@ -2,7 +2,7 @@
##############################################################################
#
# Copyright (c) 2007 Nexedi SARL and Contributors. All Rights Reserved.
# Aurlien Calonne <aurel@nexedi.com>
# Aurélien Calonne <aurel@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
......
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