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
""" """
...@@ -75,12 +68,13 @@ class TestClassTool(ERP5TypeTestCase): ...@@ -75,12 +68,13 @@ class TestClassTool(ERP5TypeTestCase):
ZopeTestCase._print(message) ZopeTestCase._print(message)
LOG('Testing... ',0,message) LOG('Testing... ',0,message)
portal = self.getPortal() portal = self.getPortal()
self.assertNotEqual(None,getattr(portal,'portal_classes',None)) self.assertNotEqual(None,getattr(portal,'portal_classes',None))
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:
...@@ -88,23 +82,21 @@ class TestClassTool(ERP5TypeTestCase): ...@@ -88,23 +82,21 @@ class TestClassTool(ERP5TypeTestCase):
ZopeTestCase._print(message) ZopeTestCase._print(message)
LOG('Testing... ',0,message) LOG('Testing... ',0,message)
portal = self.getPortal() portal = self.getPortal()
portal_classes = portal.portal_classes portal_classes = portal.portal_classes
portal_classes.newDocument('Toto') portal_classes.newDocument('Toto')
get_transaction().abort() get_transaction().abort()
self.assertNotEqual(portal_classes.getLocalDocumentList(), ['Toto']) self.assertNotEqual(portal_classes.getLocalDocumentList(), ['Toto'])
portal_classes.newDocument('Toto')
get_transaction().commit()
self.assertEqual(portal_classes.getLocalDocumentList(), ['Toto'])
portal_classes.newDocument('Toto')
get_transaction().commit()
self.assertEqual(portal_classes.getLocalDocumentList(), ['Toto'])
if __name__ == '__main__': import unittest
framework() def test_suite():
else: suite = unittest.TestSuite()
import unittest suite.addTest(unittest.makeSuite(TestClassTool))
def test_suite(): return suite
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestClassTool))
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