Commit 2d7a90c1 authored by Aurel's avatar Aurel

fake get_context in test to make Localizer work when required


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12890 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3d11c7ad
......@@ -14,6 +14,7 @@ warnings.simplefilter('ignore', DeprecationWarning, append=1)
current_app = None
import Products.ERP5Type.Utils
import Globals
# store a copy of the original method
original_get_request = Globals.get_request
......@@ -23,6 +24,13 @@ def get_request():
Products.ERP5Type.Utils.get_request = get_request
Globals.get_request = get_request
import itools.zope
def get_context():
return current_app
itools.zope.get_context = get_context
from Testing import ZopeTestCase
from Testing.ZopeTestCase.PortalTestCase import PortalTestCase, user_name
from Products.ERP5Type.tests.utils import getMySQLArguments
......@@ -79,7 +87,7 @@ try:
if isinstance(s, UnicodeType):
s = s.encode('utf8', 'repr')
OrigStringIO.write(self, s)
# iHotFix will patch PageTemplate StringIO with
# iHotFix will patch PageTemplate StringIO with
iHotfix.iHotfixStringIO = UnicodeSafeStringIO
except ImportError:
pass
......@@ -344,7 +352,7 @@ class ERP5TypeTestCase(PortalTestCase):
"""
ZopeTestCase._print('\n%s ' % message)
LOG('Testing ... ', DEBUG, message)
def _updateConnectionStrings(self):
"""Update connection strings with values passed by the testRunner
"""
......@@ -381,10 +389,10 @@ class ERP5TypeTestCase(PortalTestCase):
# Utility methods specific to ERP5Type
def getTemplateTool(self):
return getToolByName(self.getPortal(), 'portal_templates', None)
def getPreferenceTool(self) :
return getToolByName(self.getPortal(), 'portal_preferences', None)
def getTrashTool(self):
return getToolByName(self.getPortal(), 'portal_trash', None)
......@@ -436,7 +444,7 @@ class ERP5TypeTestCase(PortalTestCase):
def getCurrencyModule(self):
return getattr(self.getPortal(), 'currency_module',
getattr(self.getPortal(), 'currency', None))
def tic(self):
"""
Start all messages
......@@ -510,7 +518,7 @@ def setupERP5Site( business_template_list=(),
reindex = 0
if not quiet:
ZopeTestCase._print('Adding %s ERP5 Site ... ' % portal_name)
extra_constructor_kw = _getConnectionStringDict()
email_from_address = os.environ.get('email_from_address')
if email_from_address is not None:
......@@ -586,7 +594,7 @@ def setupERP5Site( business_template_list=(),
# Reset aq dynamic, so all unit tests will start again
from Products.ERP5Type.Base import _aq_reset
_aq_reset()
if os.environ.get('erp5_save_data_fs'):
# Quit the test in order to get a clean site
if not quiet:
......
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