From 4de0a48b6c5dde292539a8b8a67088347e0aa5a4 Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Wed, 29 Feb 2012 16:57:56 +0900
Subject: [PATCH] For Components BusinessTemplate tests, the test user must
 have Developer Role.

---
 product/ERP5/tests/testBusinessTemplate.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/product/ERP5/tests/testBusinessTemplate.py b/product/ERP5/tests/testBusinessTemplate.py
index e9c371d91b..1a649c17af 100644
--- a/product/ERP5/tests/testBusinessTemplate.py
+++ b/product/ERP5/tests/testBusinessTemplate.py
@@ -6870,6 +6870,25 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
   component_module = DocumentComponent._getDynamicModuleNamespace()
   component_portal_type = DocumentComponent.portal_type
 
+  def login(self, user_name='ERP5TypeTestCase', quiet=0):
+    """
+    XXX-arnau: Copy/paste from testDynamicClassGeneration
+    """
+    from App.config import getConfiguration
+    product_config = getattr(getConfiguration(), 'product_config', None)
+    if product_config is None:
+      class DummyDeveloperConfig(object):
+        pass
+
+      dummy_developer_config = DummyDeveloperConfig()
+      dummy_developer_config.developer_list = [user_name]
+      getConfiguration().product_config = {'erp5': dummy_developer_config}
+
+    elif user_name not in product_config['erp5'].developer_list:
+      product_config['erp5'].developer_list.append(user_name)
+
+    return super(TestDocumentTemplateItem, self).login(user_name, quiet)
+
   def stepCreateZodbDocument(self, sequence=None, **kw):
     document_id = '%s.erp5.%s' % (self.component_module, self.document_title)
     self.getPortalObject().portal_components.newContent(
-- 
2.30.9