diff --git a/product/ERP5OOo/tests/testOOoImport.py b/product/ERP5OOo/tests/testOOoImport.py index 55855d98e769aee5781afc3e136fc837132d1c4b..0c28de8c9aed055283777d777889a8d360c36947 100644 --- a/product/ERP5OOo/tests/testOOoImport.py +++ b/product/ERP5OOo/tests/testOOoImport.py @@ -30,17 +30,15 @@ import unittest import os import sys + from zLOG import LOG from Testing import ZopeTestCase from AccessControl.SecurityManagement import newSecurityManager from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.Sequence import SequenceList - ooodoc_coordinates = ('127.0.0.1', 8008) -testrun = () - def shout(msg): msg = str(msg) ZopeTestCase._print('\n ' + msg) @@ -170,9 +168,7 @@ class TestOOoImport(ERP5TypeTestCase): Simulate import of OOo file true ERP5Site_importObjectFromOOoFastInput For Person Module. """ - if testrun and 12 not in testrun:return if not run: return - if not quiet: shout('test_12_ImportObjectOOoInActivities') sequence_list = SequenceList() step_list = [ 'stepImportRawDataFile' ,'stepCheckActivitiesCount' @@ -183,6 +179,25 @@ class TestOOoImport(ERP5TypeTestCase): sequence_list.addSequenceString(sequence_string) sequence_list.play(self, quiet=quiet) + + def test_CategoryTool_importCategoryFile(self): + # tests simple use of CategoryTool_importCategoryFile script + self.portal.portal_categories.CategoryTool_importCategoryFile( + import_file=makeFileUpload('import_region_category.sxc')) + get_transaction().commit() + self.tic() + region = self.portal.portal_categories.region + self.assertEqual(2, len(region)) + self.assertTrue('europe' in region.objectIds()) + self.assertTrue('germany' in region.europe.objectIds()) + self.assertTrue('france' in region.europe.objectIds()) + france = region.europe.france + self.assertEquals('France', france.getTitle()) + self.assertEquals('A Country', france.getDescription()) + self.assertEquals('FR', france.getCodification()) + self.assertEquals(1, france.getIntIndex()) + + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestOOoImport)) diff --git a/product/ERP5OOo/tests/test_document/import_region_category.sxc b/product/ERP5OOo/tests/test_document/import_region_category.sxc new file mode 100644 index 0000000000000000000000000000000000000000..3c9825f55f7eba74952aa47b55bd7240e94b04d9 Binary files /dev/null and b/product/ERP5OOo/tests/test_document/import_region_category.sxc differ