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