[Erp5-report] r23176 - in /erp5/trunk/products/ERP5Type: DocumentationHelper/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Aug 26 16:01:56 CEST 2008


Author: jm
Date: Tue Aug 26 16:01:52 2008
New Revision: 23176

URL: http://svn.erp5.org?rev=23176&view=rev
Log:
* DocumentationHelper:
  * Fix test_01_ERP5Site unit test.
  * Remove useless getBusinessTemplateIdList.
  * Clean up getBusinessTemplateItemList.
* Fix non utf8 char in comment.

Modified:
    erp5/trunk/products/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py
    erp5/trunk/products/ERP5Type/tests/testDocumentationHelper.py
    erp5/trunk/products/ERP5Type/tests/testFolderMigration.py

Modified: erp5/trunk/products/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py?rev=23176&r1=23175&r2=23176&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py (original)
+++ erp5/trunk/products/ERP5Type/DocumentationHelper/ERP5SiteDocumentationHelper.py Tue Aug 26 16:01:52 2008
@@ -80,36 +80,17 @@
     """
     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):

Modified: erp5/trunk/products/ERP5Type/tests/testDocumentationHelper.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testDocumentationHelper.py?rev=23176&r1=23175&r2=23176&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testDocumentationHelper.py (original)
+++ erp5/trunk/products/ERP5Type/tests/testDocumentationHelper.py Tue Aug 26 16:01:52 2008
@@ -56,11 +56,7 @@
 
   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 @@
     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

Modified: erp5/trunk/products/ERP5Type/tests/testFolderMigration.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testFolderMigration.py?rev=23176&r1=23175&r2=23176&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testFolderMigration.py (original)
+++ erp5/trunk/products/ERP5Type/tests/testFolderMigration.py Tue Aug 26 16:01:52 2008
@@ -2,7 +2,7 @@
 ##############################################################################
 #
 # Copyright (c) 2007 Nexedi SARL and Contributors. All Rights Reserved.
-#          Aurélien Calonne <aurel at nexedi.com>
+#          Aurélien Calonne <aurel at nexedi.com>
 #
 # WARNING: This program as such is intended to be used by professional
 # programmers who take the whole responsability of assessing all potential




More information about the Erp5-report mailing list