本文整理汇总了Python中Products.CMFCore.tests.base.dummy.DummyContent.manage_addLocalRoles方法的典型用法代码示例。如果您正苦于以下问题:Python DummyContent.manage_addLocalRoles方法的具体用法?Python DummyContent.manage_addLocalRoles怎么用?Python DummyContent.manage_addLocalRoles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products.CMFCore.tests.base.dummy.DummyContent
的用法示例。
在下文中一共展示了DummyContent.manage_addLocalRoles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_mergedLocalRolesManipulation
# 需要导入模块: from Products.CMFCore.tests.base.dummy import DummyContent [as 别名]
# 或者: from Products.CMFCore.tests.base.dummy.DummyContent import manage_addLocalRoles [as 别名]
def test_mergedLocalRolesManipulation(self):
# The _mergedLocalRoles function used to return references to
# actual local role settings and it was possible to manipulate them
# by changing the return value. http://www.zope.org/Collectors/CMF/376
from Products.CMFCore.tests.base.dummy import DummyContent
from Products.CMFCore.utils import _mergedLocalRoles
obj = DummyContent()
obj.manage_addLocalRoles('dummyuser1', ['Manager', 'Owner'])
self.assertEqual(len(obj.get_local_roles_for_userid('dummyuser1')), 2)
merged_roles = _mergedLocalRoles(obj)
merged_roles['dummyuser1'].append('FOO')
# The values on the object itself should still the the same
self.assertEqual(len(obj.get_local_roles_for_userid('dummyuser1')), 2)