Commit 7988bc67 authored by Jérome Perrin's avatar Jérome Perrin

CodingStyleTest: run testXHTML for each business template

 - run `testXHTML` on business templates "one by one"
 - fix all the problems with the currently tested business templates
 - because `erp5_ingestion` was containing some tests skin folder depending on other business templates and because I did not want to add dependencies to `erp5_ingestion` I moved the tests in `erp5_ingestion_test`.

/reviewed-on nexedi/erp5!989
parents a9d81b09 1bf425ca
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
#from Products.ERP5Type.Globals import InitializeClass, PersistentMapping
#from Products.CMFCore.utils import getToolByName
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.Core.Predicate import Predicate
from Products.ERP5.Document.Invoice import Invoice
class AccountingRuleCell(Predicate, Invoice):
"""
An AccountingRuleCell object allows to add SaleInvoiceTransactionLines into a Matrix
"""
# Default Properties
property_sheets = (
PropertySheet.Base,
PropertySheet.XMLObject,
PropertySheet.CategoryCore,
PropertySheet.DublinCore,
PropertySheet.Delivery,
PropertySheet.Task,
PropertySheet.Arrow,
PropertySheet.Movement,
PropertySheet.Amount,
PropertySheet.Reference,
PropertySheet.PaymentCondition,
PropertySheet.Predicate,
PropertySheet.MappedValue,
)
# CMF Type Definition
meta_type = 'ERP5 Accounting Rule Cell'
portal_type = 'Accounting Rule Cell'
add_permission = Permissions.AddPortalContent
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Document Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>AccountingRuleCell</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.AccountingRuleCell</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Document Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
document.erp5.AccountingRuleCell
\ No newline at end of file
......@@ -81,7 +81,7 @@
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>BaseCrm_FieldLibrary</string> </value>
<value> <string>Base_viewCRMFieldLibrary</string> </value>
</item>
</dictionary>
</value>
......
......@@ -84,7 +84,7 @@
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>BaseCrm_FieldLibrary</string> </value>
<value> <string>Base_viewCRMFieldLibrary</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>BaseCrm_FieldLibrary</string> </value>
<value> <string>Base_viewCRMFieldLibrary</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
erp5_base
erp5_web
erp5_crm
\ No newline at end of file
erp5_ingestion
\ No newline at end of file
erp5_ingestion_test
\ No newline at end of file
erp5_full_text_mroonga_catalog
erp5_ingestion_mysql_innodb_catalog
erp5_web
erp5_crm
erp5_dms
\ No newline at end of file
erp5_ingestion_test
\ No newline at end of file
......@@ -34,7 +34,7 @@ import random
import string
# test files' home
FILE_NAME_REGULAR_EXPRESSION = "(?P<reference>[A-Z&é@{]{3,7})-(?P<language>[a-z]{2})-(?P<version>[0-9]{3})"
FILENAME_REGULAR_EXPRESSION = "(?P<reference>[A-Z&é@{]{3,7})-(?P<language>[a-z]{2})-(?P<version>[0-9]{3})"
REFERENCE_REGULAR_EXPRESSION = "(?P<reference>[A-Z&é@{]{3,7})(-(?P<language>[a-z]{2}))?(-(?P<version>[0-9]{3}))?"
class TestIngestion(ERP5TypeLiveTestCase):
......@@ -82,7 +82,7 @@ class TestIngestion(ERP5TypeLiveTestCase):
portal = self.portal
contribution_tool = getToolByName(portal, 'portal_contributions')
# seed parameter is here to ensure entropy for document id generation
seed = ''.join([random.choice(string.ascii_letters) for i in xrange(20)])
seed = ''.join([random.choice(string.ascii_letters) for _ in xrange(20)])
url = portal.absolute_url()
url += '/%s?seed=%s' % (script_id, seed)
if filename:
......
......@@ -61,11 +61,13 @@
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -78,7 +80,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_ingestion
\ No newline at end of file
Tests for erp5_ingestion
\ No newline at end of file
erp5_ingestion_test
\ No newline at end of file
erp5_web
erp5_crm
erp5_dms
erp5_full_text_myisam_catalog
\ No newline at end of file
erp5_ingestion_test
\ No newline at end of file
......@@ -289,7 +289,7 @@
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>web_page_module_view_web_page_list_selection</string> </value>
<value> <string>web_page_module_view_document_list_as_jio_for_codemirror_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
......
......@@ -289,7 +289,7 @@
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>web_page_module_view_web_page_list_selection</string> </value>
<value> <string>document_module_view_document_list_as_jio_for_pdf_viewer_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
......
......@@ -297,7 +297,7 @@
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>image_selection</string> </value>
<value> <string>web_page_module_view_document_list_as_jio_for_svg_editor_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
......
......@@ -289,7 +289,7 @@
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>web_page_module_view_web_page_list_selection</string> </value>
<value> <string>web_page_module_view_document_list_as_jio_for_text_editor_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
......
......@@ -297,7 +297,7 @@
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>image_selection</string> </value>
<value> <string>image_module_image_list_as_jio_for_image_editor_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
......
......@@ -289,7 +289,7 @@
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>web_page_module_view_web_page_list_selection</string> </value>
<value> <string>web_page_module_document_list_as_jio_for_web_table_editor_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
......
......@@ -289,7 +289,7 @@
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>web_page_module_view_web_page_list_selection</string> </value>
<value> <string>document_module_document_list_as_jio_for_ooffice_presentation_editor_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
......
......@@ -289,7 +289,7 @@
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>web_page_module_view_web_page_list_selection</string> </value>
<value> <string>document_module_document_list_as_jio_for_ooffice_spreadsheet_editor_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
......
......@@ -289,7 +289,7 @@
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>web_page_module_view_web_page_list_selection</string> </value>
<value> <string>document_module_document_list_as_jio_for_ooffice_text_editor_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
......
erp5_project
erp5_crm
\ No newline at end of file
......@@ -546,7 +546,7 @@
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string></string> </value>
<value> <string>research_item_module_view_research_summary_report_data_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
......
erp5_accounting
erp5_trade
erp5_web_service
\ No newline at end of file
......@@ -197,7 +197,7 @@
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>ticket_view_selection</string> </value>
<value> <string>ticket_view_related_record_list_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
......
......@@ -301,7 +301,7 @@
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
python: \'<video autoplay="true" controls="controls" src="\'+here.absolute_url()+\'?inline=True&format="></video>\'
python: \'<video autoplay="autoplay" controls="controls" src="\'+here.absolute_url()+\'?inline=True&format="></video>\'
]]></string> </value>
</item>
......
......@@ -225,7 +225,7 @@
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>project_module_selection</string> </value>
<value> <string>project_module_project_management_selection</string> </value>
</item>
<item>
<key> <string>target</string> </key>
......
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>base_view_document_selection</string> </value>
<value> <string>project_view_document_selection</string> </value>
</item>
<item>
<key> <string>target</string> </key>
......
......@@ -57,6 +57,7 @@ class TestWebCrawler(ERP5TypeTestCase):
return ('erp5_core_proxy_field_legacy',
'erp5_base',
'erp5_ingestion',
'erp5_ingestion_test',
'erp5_ingestion_mysql_innodb_catalog',
'erp5_web',
'erp5_dms')
......
......@@ -94,7 +94,7 @@ class VideoWidget(Widget.TextWidget):
if field.get_value('video_loop'):
extra_kw['loop']='loop'
if field.get_value('video_preload'):
extra_kw['preload']='preload'
extra_kw['preload']='auto'
return Widget.render_element("video",
src=value,
extra=field.get_value('extra'),
......
......@@ -43,7 +43,7 @@ class TestVideoField(ERP5TypeTestCase):
def test_render_view(self):
self.field.values['default'] = 'Video content'
self.assertEqual('<video preload="preload" src="Video content" controls="controls" height="85" width="160" >Your browser does not support video tag.</video>', \
self.assertEqual('<video preload="auto" src="Video content" controls="controls" height="85" width="160" >Your browser does not support video tag.</video>', \
self.field.render_view(value='Video content'))
self.field.values['video_preload'] = False
......
......@@ -31,9 +31,12 @@ import os
import unittest
from glob import glob
from Products.ERP5.tests import testXHTML
from Products.ERP5Type.tests.utils import addUserToDeveloperRole
from Products.ERP5Type.tests.CodingStyleTestCase import CodingStyleTestCase
class CodingStyleTest(CodingStyleTestCase):
class CodingStyleTest(CodingStyleTestCase, testXHTML.TestXHTMLMixin):
"""Run a coding style test for business template defined by
TESTED_BUSINESS_TEMPLATE environment variable, that is set by
ERP5BusinessTemplateCodingStyleTestSuite in test/__init__.py
......@@ -81,15 +84,29 @@ class CodingStyleTest(CodingStyleTestCase):
self)._installBusinessTemplateList(url_bt_tuple_list,
*args, **kwargs)
def test_suite():
suite = unittest.TestSuite()
tested_business_template = os.environ['TESTED_BUSINESS_TEMPLATE']
testclass = type(
'CodingStyleTest %s' % tested_business_template,
(CodingStyleTest, ),
{'tested_business_template': tested_business_template})
(CodingStyleTest,),
{
'tested_business_template': tested_business_template,
# currently, jsl based test_javascript_lint report too many false positives.
'test_javascript_lint': None,
},
)
testXHTML.addTestMethodDynamically(
testclass,
testXHTML.validator,
(tested_business_template,),
)
# required to create content in portal_components
addUserToDeveloperRole('ERP5TypeTestCase')
suite.addTest(unittest.makeSuite(testclass))
return suite
......@@ -80,8 +80,7 @@ class ERP5(_ERP5):
or full_test_case)
# skip some tests
if test_case.startswith('testLive') or test_case.startswith('testVifib') \
or test_case.find('Performance') > 0 \
if test_case.find('Performance') > 0 \
or test_case in ('testERP5LdapCatalog', # XXX (Ivan), until LDAP server is available this test will alway fail
# tests reading selenium tables from erp5.com
# not maintained
......
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