Commit f56158cf authored by Jérome Perrin's avatar Jérome Perrin

Install a real class tool even if ALLOW_CLASS_TOOL file does not exists.

Remove oldies (framework)
Fix indentation problem (code would not run in quiet mode)



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13218 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d2e0e549
...@@ -26,19 +26,10 @@ ...@@ -26,19 +26,10 @@
# #
############################################################################## ##############################################################################
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
# Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
os.environ['EVENT_LOG_SEVERITY'] = '-300'
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.CachePlugins.DummyCache import DummyCache
from Products.ERP5Type.Cache import CachingMethod
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.utils import installRealClassTool
from zLOG import LOG from zLOG import LOG
import time import time
...@@ -50,12 +41,14 @@ except ImportError: ...@@ -50,12 +41,14 @@ except ImportError:
class TestClassTool(ERP5TypeTestCase): class TestClassTool(ERP5TypeTestCase):
run_all_test = 1 run_all_test = 1
quiet = 1
def getTitle(self): def getTitle(self):
return "Class Tool" return "Class Tool"
def afterSetUp(self): def afterSetUp(self):
self.login() self.login()
installRealClassTool(self.getPortal())
def login(self, quiet=0, run=run_all_test): def login(self, quiet=0, run=run_all_test):
uf = self.getPortal().acl_users uf = self.getPortal().acl_users
...@@ -64,7 +57,7 @@ class TestClassTool(ERP5TypeTestCase): ...@@ -64,7 +57,7 @@ class TestClassTool(ERP5TypeTestCase):
user = uf.getUserById('seb').__of__(uf) user = uf.getUserById('seb').__of__(uf)
newSecurityManager(None, user) newSecurityManager(None, user)
def test_01_CheckClassTool(self, quiet=0, run=run_all_test): def test_01_CheckClassTool(self, quiet=quiet, run=run_all_test):
""" """
Make sure that portal_classes exists Make sure that portal_classes exists
""" """
...@@ -80,7 +73,8 @@ class TestClassTool(ERP5TypeTestCase): ...@@ -80,7 +73,8 @@ class TestClassTool(ERP5TypeTestCase):
get_transaction().commit() get_transaction().commit()
def test_02_CheckFileWriteIsTransactional(self, quiet=0, run=run_all_test): def test_02_CheckFileWriteIsTransactional(self, quiet=quiet,
run=run_all_test):
if not run: if not run:
return return
if not quiet: if not quiet:
...@@ -99,11 +93,9 @@ class TestClassTool(ERP5TypeTestCase): ...@@ -99,11 +93,9 @@ class TestClassTool(ERP5TypeTestCase):
get_transaction().commit() get_transaction().commit()
self.assertEqual(portal_classes.getLocalDocumentList(), ['Toto']) self.assertEqual(portal_classes.getLocalDocumentList(), ['Toto'])
if __name__ == '__main__':
framework() import unittest
else: def test_suite():
import unittest
def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestClassTool)) suite.addTest(unittest.makeSuite(TestClassTool))
return suite return suite
......
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