Commit b726f618 authored by Jérome Perrin's avatar Jérome Perrin

use RoleInformation methods getCategory and getBaseCategory instead of

accessing atributes directly.
add test for missing role information values



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24609 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b1c894e4
...@@ -2323,11 +2323,8 @@ class PortalTypeRolesTemplateItem(BaseTemplateItem): ...@@ -2323,11 +2323,8 @@ class PortalTypeRolesTemplateItem(BaseTemplateItem):
if prop_value: if prop_value:
type_role_dict['condition'] = prop_value.text type_role_dict['condition'] = prop_value.text
# multi # multi
for property in ('category', 'base_category'): type_role_dict['category'] = role.getCategory()
prop_value_list = [] type_role_dict['base_category'] = role.getBaseCategory()
for prop_value in getattr(role, property):
prop_value_list.append(prop_value)
type_role_dict[property] = prop_value_list
type_role_list.append(type_role_dict) type_role_list.append(type_role_dict)
self._objects[relative_url] = type_role_list self._objects[relative_url] = type_role_list
......
...@@ -4935,8 +4935,8 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -4935,8 +4935,8 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
name='Geek Role Definition', name='Geek Role Definition',
condition='', condition='',
category='group/g1\nfunction/f1\n', category='group/g1\nfunction/f1\n',
base_category_script='', base_category_script='Base Category Script',
base_category='',) base_category='group site',)
sequence.edit(portal_type_role='geek_role_definition') sequence.edit(portal_type_role='geek_role_definition')
...@@ -4968,6 +4968,8 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor): ...@@ -4968,6 +4968,8 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
self.assertEquals('Geek Role Definition', role.title) self.assertEquals('Geek Role Definition', role.title)
self.assertEquals('A definition with non ascii chars éàè', role.description) self.assertEquals('A definition with non ascii chars éàè', role.description)
self.assertEquals(('group/g1','function/f1'), role.getCategory()) self.assertEquals(('group/g1','function/f1'), role.getCategory())
self.assertEquals(('group','site'), role.getBaseCategory())
self.assertEquals('Base Category Script', role.getBaseCategoryScript())
def test_36_CheckPortalTypeRoles(self, quiet=quiet, run=run_all_test): def test_36_CheckPortalTypeRoles(self, quiet=quiet, run=run_all_test):
if not run: return if not run: return
......
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