From c7fb7be0c5a3380ad48e38ee9da0a5299bee2de1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 4 May 2006 14:13:31 +0000
Subject: [PATCH] Check allowed content types are correctly installed (not
 complete yet, it has to be extended to update an existing type)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7082 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testBusinessTemplate.py | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/product/ERP5/tests/testBusinessTemplate.py b/product/ERP5/tests/testBusinessTemplate.py
index ab3318a1b5..4c8213a6b7 100644
--- a/product/ERP5/tests/testBusinessTemplate.py
+++ b/product/ERP5/tests/testBusinessTemplate.py
@@ -259,17 +259,23 @@ class TestBusinessTemplate(ERP5TypeTestCase):
     """
     pt = self.getTypeTool()
     # create module object portal type
-    pt.manage_addTypeInformation(ERP5TypeInformation.meta_type, id='Geek Object', typeinfo_name='ERP5Type: ERP5 Person')
+    pt.manage_addTypeInformation(ERP5TypeInformation.meta_type,
+                                 id='Geek Object',
+                                 typeinfo_name='ERP5Type: ERP5 Person',)
     object_type = pt._getOb('Geek Object', None)
     self.failUnless(object_type is not None)
     sequence.edit(object_ptype_id=object_type.getId())
     # create module portal type
-    pt.manage_addTypeInformation(ERP5TypeInformation.meta_type, id='Geek Module', typeinfo_name='ERP5Type: ERP5 Folder')
+    pt.manage_addTypeInformation(ERP5TypeInformation.meta_type,
+                                 id='Geek Module',
+                                 typeinfo_name='ERP5Type: ERP5 Folder')
     module_type = pt._getOb('Geek Module', None)
     self.failUnless(module_type is not None)
     module_type.filter_content_types = 1
     module_type.allowed_content_types = ('Geek Object',)
-    sequence.edit(module_ptype_id=module_type.getId())
+    sequence.edit(module_ptype_id=module_type.getId(),
+          module_ptype_filter_content_types=module_type.filter_content_types,
+          module_ptype_allowed_content_types=module_type.allowed_content_types)
 
   def stepAddPortalTypeToBusinessTemplate(self, sequence=None, sequence_list=None, **kw):
     """
@@ -280,7 +286,7 @@ class TestBusinessTemplate(ERP5TypeTestCase):
     ptype_ids = []
     ptype_ids.append(sequence.get('object_ptype_id', ''))
     ptype_ids.append(sequence.get('module_ptype_id', ''))
-    self.assertEqual(len(ptype_ids), 2)    
+    self.assertEqual(len(ptype_ids), 2)
     bt.edit(template_portal_type_id_list=ptype_ids)
     self.stepFillPortalTypesFields(sequence=sequence, sequence_list=sequence_list, **kw)
     
@@ -306,9 +312,13 @@ class TestBusinessTemplate(ERP5TypeTestCase):
     module_id = sequence.get('module_ptype_id')
     module_type = pt._getOb(module_id, None)
     self.failUnless(module_type is not None)
+    self.failUnless(module_type.allowed_content_types,
+        sequence.get('module_ptype_allowed_content_types'))
+    self.failUnless(module_type.filter_content_types,
+        sequence.get('module_ptype_filter_content_types'))
     object_type = pt._getOb(object_id, None)
     self.failUnless(object_type is not None)
-    
+
   def stepCheckPortalTypeRemoved(self, sequence=None, sequence_list=None, **kw):
     """
     Check non presence of portal type
-- 
2.30.9