Commit 5c9f5d33 authored by Jérome Perrin's avatar Jérome Perrin

tests simple use of CategoryTool_importCategoryFile script



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16677 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2e96067a
...@@ -30,17 +30,15 @@ ...@@ -30,17 +30,15 @@
import unittest import unittest
import os import os
import sys import sys
from zLOG import LOG from zLOG import LOG
from Testing import ZopeTestCase from Testing import ZopeTestCase
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
ooodoc_coordinates = ('127.0.0.1', 8008) ooodoc_coordinates = ('127.0.0.1', 8008)
testrun = ()
def shout(msg): def shout(msg):
msg = str(msg) msg = str(msg)
ZopeTestCase._print('\n ' + msg) ZopeTestCase._print('\n ' + msg)
...@@ -170,9 +168,7 @@ class TestOOoImport(ERP5TypeTestCase): ...@@ -170,9 +168,7 @@ class TestOOoImport(ERP5TypeTestCase):
Simulate import of OOo file true ERP5Site_importObjectFromOOoFastInput Simulate import of OOo file true ERP5Site_importObjectFromOOoFastInput
For Person Module. For Person Module.
""" """
if testrun and 12 not in testrun:return
if not run: return if not run: return
if not quiet: shout('test_12_ImportObjectOOoInActivities')
sequence_list = SequenceList() sequence_list = SequenceList()
step_list = [ 'stepImportRawDataFile' step_list = [ 'stepImportRawDataFile'
,'stepCheckActivitiesCount' ,'stepCheckActivitiesCount'
...@@ -183,6 +179,25 @@ class TestOOoImport(ERP5TypeTestCase): ...@@ -183,6 +179,25 @@ class TestOOoImport(ERP5TypeTestCase):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) 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(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestOOoImport)) suite.addTest(unittest.makeSuite(TestOOoImport))
......
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