Commit 23b7eb8a authored by Arnaud Fontaine's avatar Arnaud Fontaine

For Components tests, override login() to add Developer Role rather than hardcoding the user name.

parent e48a89dc
...@@ -1235,19 +1235,22 @@ class _TestZodbComponent(SecurityTestCase): ...@@ -1235,19 +1235,22 @@ class _TestZodbComponent(SecurityTestCase):
return ('erp5_base', return ('erp5_base',
'erp5_core_component') 'erp5_core_component')
def afterSetUp(self): def login(self, user_name='ERP5TypeTestCase', quiet=0):
product_config = getattr(getConfiguration(), 'product_config', None) product_config = getattr(getConfiguration(), 'product_config', None)
if product_config is None: if product_config is None:
class DummyDeveloperConfig(object): class DummyDeveloperConfig(object):
pass pass
dummy_developer_config = DummyDeveloperConfig() dummy_developer_config = DummyDeveloperConfig()
dummy_developer_config.developer_list = ['ERP5TypeTestCase'] dummy_developer_config.developer_list = [user_name]
getConfiguration().product_config = {'erp5': dummy_developer_config} getConfiguration().product_config = {'erp5': dummy_developer_config}
elif 'ERP5TypeTestCase' not in product_config['erp5'].developer_list: elif user_name not in product_config['erp5'].developer_list:
product_config['erp5'].developer_list.append('ERP5TypeTestCase') product_config['erp5'].developer_list.append(user_name)
return super(_TestZodbComponent, self).login(user_name, quiet)
def afterSetUp(self):
self._component_tool = self.getPortal().portal_components self._component_tool = self.getPortal().portal_components
self._module = __import__(self._getComponentModuleName(), self._module = __import__(self._getComponentModuleName(),
fromlist=['erp5.component']) fromlist=['erp5.component'])
......
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