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

stepCreatePortalTypeRole was setting _roles on types tool, not the portal type

itself, use addRole method instead and also check a few more properties on role
information.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24606 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 85f28dcf
##############################################################################
#
# -*- coding: utf8 -*-
# Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved.
# Aurelien Calonne <aurel@nexedi.com>
#
......@@ -4930,9 +4930,14 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
pt = self.getTypeTool()
object_id = sequence.get('object_ptype_id')
object_pt = pt._getOb(object_id)
role = RoleInformation('geek_role_definition',
title='Geek Role Definition')
setattr(pt, '_roles', [role])
object_pt.addRole(id='geek_role_definition',
description='A definition with non ascii chars éàè',
name='Geek Role Definition',
condition='',
category='group/g1\nfunction/f1\n',
base_category_script='',
base_category='',)
sequence.edit(portal_type_role='geek_role_definition')
def stepAddPortalTypeRolesToBusinessTemplate(self, sequence=None,
......@@ -4956,9 +4961,13 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
pt = self.getTypeTool()
object_id = sequence.get('object_ptype_id')
object_pt = pt._getOb(object_id)
role_list = pt._roles
self.assertTrue('geek_role_definition' in \
[x.id for x in role_list])
role_list = object_pt._roles
role_list = [x for x in role_list if x.id == 'geek_role_definition']
self.assertEquals(1, len(role_list))
role = role_list[0]
self.assertEquals('Geek Role Definition', role.title)
self.assertEquals('A definition with non ascii chars éàè', role.description)
self.assertEquals(('group/g1','function/f1'), role.getCategory())
def test_36_CheckPortalTypeRoles(self, quiet=quiet, run=run_all_test):
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