Commit 2bf6881c authored by Fabien Morin's avatar Fabien Morin

code cleaning :

 * remove unused spaces
 * remove the use of run parameter : now "--run_only=test_name" parameter can
   be passed to runUnitTest to run only desired tests, so this beucome useless.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31267 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3f690710
...@@ -41,7 +41,6 @@ from lxml import etree ...@@ -41,7 +41,6 @@ from lxml import etree
import os import os
class TestFormPrintoutAsODT(TestFormPrintoutMixin): class TestFormPrintoutAsODT(TestFormPrintoutMixin):
run_all_test = 1
def getTitle(self): def getTitle(self):
""" """
...@@ -129,12 +128,10 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -129,12 +128,10 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
transaction.commit() transaction.commit()
self.tic() self.tic()
def test_01_Paragraph(self, run=run_all_test): def test_01_Paragraph(self):
""" """
mapping a field to a paragraph mapping a field to a paragraph
""" """
if not run: return
portal = self.getPortal() portal = self.getPortal()
foo_module = self.portal.foo_module foo_module = self.portal.foo_module
if foo_module._getOb('test1', None) is None: if foo_module._getOb('test1', None) is None:
...@@ -230,10 +227,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -230,10 +227,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
self.assertTrue(content_xml.find("Français test2") > 0) self.assertTrue(content_xml.find("Français test2") > 0)
self._validate(odf_document) self._validate(odf_document)
def test_01_Paragraph_07_LinesField(self, run=run_all_test): def test_01_Paragraph_07_LinesField(self):
"""test LinesField into multi line""" """test LinesField into multi line"""
if not run: return
foo_printout = self.portal.foo_module.test1.Foo_viewAsPrintout foo_printout = self.portal.foo_module.test1.Foo_viewAsPrintout
foo_form = self.portal.foo_module.test1.Foo_view foo_form = self.portal.foo_module.test1.Foo_view
if foo_form._getOb("week", None) is None: if foo_form._getOb("week", None) is None:
...@@ -256,10 +251,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -256,10 +251,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
self.assertEquals('line2', span[0].tail) self.assertEquals('line2', span[0].tail)
self._validate(odf_document) self._validate(odf_document)
def test_01_Paragraph_08_Field_Format(self, run=run_all_test): def test_01_Paragraph_08_Field_Format(self):
"""test a field with format""" """test a field with format"""
if not run: return
foo_printout = self.portal.foo_module.test1.Foo_viewAsPrintout foo_printout = self.portal.foo_module.test1.Foo_viewAsPrintout
foo_form = self.portal.foo_module.test1.Foo_view foo_form = self.portal.foo_module.test1.Foo_view
if foo_form._getOb("number", None) is None: if foo_form._getOb("number", None) is None:
...@@ -289,10 +282,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -289,10 +282,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
self._validate(odf_document) self._validate(odf_document)
def test_01_Paragraph_09_RangeReferenceWithSpan(self, run=run_all_test): def test_01_Paragraph_09_RangeReferenceWithSpan(self):
"""test range reference and span setting""" """test range reference and span setting"""
if not run: return
foo_printout = self.portal.foo_module.test1.Foo_viewAsPrintout foo_printout = self.portal.foo_module.test1.Foo_viewAsPrintout
foo_form = self.portal.foo_module.test1.Foo_view foo_form = self.portal.foo_module.test1.Foo_view
if foo_form._getOb("my_test_title", None) is None: if foo_form._getOb("my_test_title", None) is None:
...@@ -310,7 +301,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -310,7 +301,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
self.assertTrue(content_xml.find("test title") < 0) self.assertTrue(content_xml.find("test title") < 0)
self._validate(odf_document) self._validate(odf_document)
def test_02_Table_01_Normal(self, run=run_all_test): def test_02_Table_01_Normal(self):
"""To test listbox and ODF table mapping """To test listbox and ODF table mapping
* Test Data Format * Test Data Format
...@@ -362,9 +353,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -362,9 +353,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
self.assertTrue(content_xml.find("foo_title_1") > 0) self.assertTrue(content_xml.find("foo_title_1") > 0)
self._validate(odf_document) self._validate(odf_document)
def test_02_Table_02_SmallerThanListboxColumns(self, run=run_all_test): def test_02_Table_02_SmallerThanListboxColumns(self):
"""2. Irregular case: listbox columns count smaller than table columns count""" """2. Irregular case: listbox columns count smaller than table columns count"""
if not run: return
# test target # test target
test1 = self.portal.foo_module.test1 test1 = self.portal.foo_module.test1
foo_printout = test1.Foo_viewAsPrintout foo_printout = test1.Foo_viewAsPrintout
...@@ -405,9 +395,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -405,9 +395,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
self.assertTrue(content_xml.find("foo_title_2") > 0) self.assertTrue(content_xml.find("foo_title_2") > 0)
self._validate(odf_document) self._validate(odf_document)
def test_02_Table_03_ListboxColumnsLargerThanTable(self, run=run_all_test): def test_02_Table_03_ListboxColumnsLargerThanTable(self):
"""3. Irregular case: listbox columns count larger than table columns count""" """3. Irregular case: listbox columns count larger than table columns count"""
if not run: return
# test target # test target
test1 = self.portal.foo_module.test1 test1 = self.portal.foo_module.test1
foo_printout = test1.Foo_viewAsPrintout foo_printout = test1.Foo_viewAsPrintout
...@@ -442,9 +431,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -442,9 +431,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
self.assertTrue(content_xml.find("foo_title_3") > 0) self.assertTrue(content_xml.find("foo_title_3") > 0)
self._validate(odf_document) self._validate(odf_document)
def test_02_Table_04_ListboxHasNotStat(self, run=run_all_test): def test_02_Table_04_ListboxHasNotStat(self):
"""4. Irregular case: listbox has not a stat line, but table has a stat line""" """4. Irregular case: listbox has not a stat line, but table has a stat line"""
if not run: return
# test target # test target
test1 = self.portal.foo_module.test1 test1 = self.portal.foo_module.test1
foo_printout = test1.Foo_viewAsPrintout foo_printout = test1.Foo_viewAsPrintout
...@@ -492,7 +480,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -492,7 +480,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
self.assertEqual(int(last_row_columns[0].attrib[span_attribute]), 2) self.assertEqual(int(last_row_columns[0].attrib[span_attribute]), 2)
self._validate(odf_document) self._validate(odf_document)
def test_02_Table_05_NormalSameLayout(self, run=run_all_test): def test_02_Table_05_NormalSameLayout(self):
"""5. Normal case: the listobx and the ODF table are same layout """5. Normal case: the listobx and the ODF table are same layout
* Test Data Format: * Test Data Format:
...@@ -504,8 +492,6 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -504,8 +492,6 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
| | | | | | | | | |
+-------+-------+-------+-------+ +-------+-------+-------+-------+
""" """
if not run: return
# test target # test target
test1 = self.portal.foo_module.test1 test1 = self.portal.foo_module.test1
foo_printout = test1.Foo_viewAsPrintout foo_printout = test1.Foo_viewAsPrintout
...@@ -548,8 +534,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -548,8 +534,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
# put back the field name # put back the field name
foo_form.manage_renameObject('listbox2', 'listbox', REQUEST=request) foo_form.manage_renameObject('listbox2', 'listbox', REQUEST=request)
def test_02_Table_06_TableDoesNotHaveAHeader(self):
def test_02_Table_06_TableDoesNotHaveAHeader(self, run=run_all_test):
"""6. Normal case: ODF table does not have a header """6. Normal case: ODF table does not have a header
* Test Data format: * Test Data format:
...@@ -562,7 +547,6 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -562,7 +547,6 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
| | | | | | | | | |
+-------+-------+-------+-------+ +-------+-------+-------+-------+
""" """
if not run: return
# test target # test target
test1 = self.portal.foo_module.test1 test1 = self.portal.foo_module.test1
foo_printout = test1.Foo_viewAsPrintout foo_printout = test1.Foo_viewAsPrintout
...@@ -599,9 +583,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -599,9 +583,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
# put back the field name # put back the field name
foo_form.manage_renameObject('listbox3', 'listbox', REQUEST=request) foo_form.manage_renameObject('listbox3', 'listbox', REQUEST=request)
def test_02_Table_07_CellFormat(self, run=run_all_test): def test_02_Table_07_CellFormat(self):
"""7. Normal case: cell format cetting""" """7. Normal case: cell format cetting"""
if not run: return
# test target # test target
test1 = self.portal.foo_module.test1 test1 = self.portal.foo_module.test1
foo_printout = test1.Foo_viewAsPrintout foo_printout = test1.Foo_viewAsPrintout
...@@ -646,9 +629,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -646,9 +629,8 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
self.assertEqual(date_column.attrib[date_value_attrib], '2009-04-20') self.assertEqual(date_column.attrib[date_value_attrib], '2009-04-20')
self._validate(odf_document) self._validate(odf_document)
def test_02_Table_08_Nodata(self, run=run_all_test): def test_02_Table_08_Nodata(self):
"""8. Normal case: list box has no data""" """8. Normal case: list box has no data"""
if not run: return
# test target # test target
test1 = self.portal.foo_module.test1 test1 = self.portal.foo_module.test1
foo_printout = test1.Foo_viewAsPrintout foo_printout = test1.Foo_viewAsPrintout
...@@ -680,13 +662,12 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -680,13 +662,12 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
self.assertEqual(len(odf_table_rows), 0) self.assertEqual(len(odf_table_rows), 0)
self._validate(odf_document) self._validate(odf_document)
def test_02_Table_09_StyleSetting(self, run=run_all_test): def test_02_Table_09_StyleSetting(self):
""" 9. Normal case: setting the style of the row. """ 9. Normal case: setting the style of the row.
* Test Data format: * Test Data format:
The table listbox4 has six rows which contains the reference of the row. The table listbox4 has six rows which contains the reference of the row.
""" """
if not run: return
# test target # test target
test1 = self.portal.foo_module.test1 test1 = self.portal.foo_module.test1
foo_printout = test1.Foo_viewAsPrintout foo_printout = test1.Foo_viewAsPrintout
...@@ -770,17 +751,16 @@ for n in xrange(6, 0, -1): ...@@ -770,17 +751,16 @@ for n in xrange(6, 0, -1):
# delete the test objects # delete the test objects
test1.manage_delObjects(['foo_3','foo_4','foo_5','foo_6']) test1.manage_delObjects(['foo_3','foo_4','foo_5','foo_6'])
def _test_03_Frame(self, run=run_all_test): def _test_03_Frame(self):
""" """
Frame not tested yet Frame not tested yet
""" """
pass pass
def test_04_Iteration(self, run=run_all_test): def test_04_Iteration(self):
""" """
Iteration using ERP5Report ReportSection test Iteration using ERP5Report ReportSection test
""" """
if not run: return
# create test target # create test target
custom = self.portal.portal_skins.custom custom = self.portal.portal_skins.custom
erp5form = custom.manage_addProduct['ERP5Form'] erp5form = custom.manage_addProduct['ERP5Form']
...@@ -881,11 +861,10 @@ return [] ...@@ -881,11 +861,10 @@ return []
self._validate(odf_document) self._validate(odf_document)
def test_04_Iteration_02_Section(self, run=run_all_test): def test_04_Iteration_02_Section(self):
""" """
Iteration using ERP5Report ReportSection and ODF Section test Iteration using ERP5Report ReportSection and ODF Section test
""" """
if not run: return
# create test target # create test target
custom = self.portal.portal_skins.custom custom = self.portal.portal_skins.custom
erp5form = custom.manage_addProduct['ERP5Form'] erp5form = custom.manage_addProduct['ERP5Form']
...@@ -986,11 +965,10 @@ return [] ...@@ -986,11 +965,10 @@ return []
self._validate(odf_document) self._validate(odf_document)
def test_04_Iteration_03_ReportBox_and_Section(self, run=run_all_test): def test_04_Iteration_03_ReportBox_and_Section(self):
""" """
Iteration using ReportBox and ODF Section test Iteration using ReportBox and ODF Section test
""" """
if not run: return
# create test target # create test target
custom = self.portal.portal_skins.custom custom = self.portal.portal_skins.custom
erp5form = custom.manage_addProduct['ERP5Form'] erp5form = custom.manage_addProduct['ERP5Form']
...@@ -1098,23 +1076,22 @@ return [] ...@@ -1098,23 +1076,22 @@ return []
self.assertEqual(len(section_list), 0) self.assertEqual(len(section_list), 0)
self._validate(odf_document) self._validate(odf_document)
def _test_05_Styles(self, run=run_all_test): def _test_05_Styles(self):
""" """
styles.xml not tested yet styles.xml not tested yet
""" """
pass pass
def _test_06_Meta(self, run=run_all_test): def _test_06_Meta(self):
""" """
meta.xml not supported yet meta.xml not supported yet
""" """
pass pass
def test_07_Image(self, run=run_all_test): def test_07_Image(self):
""" """
Image mapping not tested yet Image mapping not tested yet
""" """
if not run: return
current_dir = os.path.dirname(__file__) current_dir = os.path.dirname(__file__)
parent_dir = os.path.dirname(current_dir) parent_dir = os.path.dirname(current_dir)
image_path = os.path.join(parent_dir, image_path = os.path.join(parent_dir,
...@@ -1162,9 +1139,8 @@ return [] ...@@ -1162,9 +1139,8 @@ return []
self.assertTrue(content_xml.find('<draw:image xlink:href') < 0) self.assertTrue(content_xml.find('<draw:image xlink:href') < 0)
self._validate(odf_document) self._validate(odf_document)
def test_08_OOoConversion(self, run=run_all_test): def test_08_OOoConversion(self):
"""test ooo conversion""" """test ooo conversion"""
if not run: return
foo_printout = self.portal.foo_module.test1.Foo_viewAsPrintout foo_printout = self.portal.foo_module.test1.Foo_viewAsPrintout
foo_form = self.portal.foo_module.test1.Foo_view foo_form = self.portal.foo_module.test1.Foo_view
if foo_form._getOb("my_test_title", None) is None: if foo_form._getOb("my_test_title", None) is None:
...@@ -1184,7 +1160,7 @@ return [] ...@@ -1184,7 +1160,7 @@ return []
#test_output.write(printout.data) #test_output.write(printout.data)
self.assertEqual('application/msword', guessMime(printout.data)) self.assertEqual('application/msword', guessMime(printout.data))
def test_09_FieldReplacement(self, run=run_all_test): def test_09_FieldReplacement(self):
"""test field in ODF Documents""" """test field in ODF Documents"""
foo_printout = self.portal.foo_module.test1.Foo5_viewAsPrintout foo_printout = self.portal.foo_module.test1.Foo5_viewAsPrintout
self._validate(self.getODFDocumentFromPrintout(foo_printout)) self._validate(self.getODFDocumentFromPrintout(foo_printout))
......
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