本文整理汇总了Python中trac.ticket.api.TicketSystem.get_allowed_owners方法的典型用法代码示例。如果您正苦于以下问题:Python TicketSystem.get_allowed_owners方法的具体用法?Python TicketSystem.get_allowed_owners怎么用?Python TicketSystem.get_allowed_owners使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.ticket.api.TicketSystem
的用法示例。
在下文中一共展示了TicketSystem.get_allowed_owners方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TicketSystemTestCase
# 需要导入模块: from trac.ticket.api import TicketSystem [as 别名]
# 或者: from trac.ticket.api.TicketSystem import get_allowed_owners [as 别名]
#.........这里部分代码省略.........
self.assertEqual(['leave', 'resolve', 'reassign', 'accept'],
self._get_actions({'status': 'reopened'}))
self.assertEqual(['leave', 'reopen'],
self._get_actions({'status': 'closed'}))
def test_available_actions_no_perms(self):
self.req.perm = PermissionCache(self.env)
self.assertEqual(['leave'], self._get_actions({'status': 'new'}))
self.assertEqual(['leave'], self._get_actions({'status': 'assigned'}))
self.assertEqual(['leave'], self._get_actions({'status': 'accepted'}))
self.assertEqual(['leave'], self._get_actions({'status': 'reopened'}))
self.assertEqual(['leave'], self._get_actions({'status': 'closed'}))
def test_available_actions_create_only(self):
self.perm.grant_permission('anonymous', 'TICKET_CREATE')
self.req.perm = PermissionCache(self.env)
self.assertEqual(['leave'], self._get_actions({'status': 'new'}))
self.assertEqual(['leave'], self._get_actions({'status': 'assigned'}))
self.assertEqual(['leave'], self._get_actions({'status': 'accepted'}))
self.assertEqual(['leave'], self._get_actions({'status': 'reopened'}))
self.assertEqual(['leave', 'reopen'],
self._get_actions({'status': 'closed'}))
def test_available_actions_chgprop_only(self):
# CHGPROP is not enough for changing a ticket's state (#3289)
self.perm.grant_permission('anonymous', 'TICKET_CHGPROP')
self.req.perm = PermissionCache(self.env)
self.assertEqual(['leave'], self._get_actions({'status': 'new'}))
self.assertEqual(['leave'], self._get_actions({'status': 'assigned'}))
self.assertEqual(['leave'], self._get_actions({'status': 'accepted'}))
self.assertEqual(['leave'], self._get_actions({'status': 'reopened'}))
self.assertEqual(['leave'], self._get_actions({'status': 'closed'}))
def test_get_allowed_owners_restrict_owner_false(self):
self.env.config.set('ticket', 'restrict_owner', False)
self.assertIsNone(self.ticket_system.get_allowed_owners())
def test_get_allowed_owners_restrict_owner_true(self):
self.env.config.set('ticket', 'restrict_owner', True)
self.env.insert_known_users([('user3', None, None),
('user1', None, None)])
self.perm.grant_permission('user4', 'TICKET_MODIFY')
self.perm.grant_permission('user3', 'TICKET_MODIFY')
self.perm.grant_permission('user2', 'TICKET_VIEW')
self.perm.grant_permission('user1', 'TICKET_MODIFY')
self.assertEqual(['user1', 'user3'],
self.ticket_system.get_allowed_owners())
def test_get_ticket_fields_version_rename(self):
"""Cached ticket fields are updated when version is renamed."""
fields = self.ticket_system.get_ticket_fields()
version_field = self._get_ticket_field('version')
v2 = Version(self.env, '2.0')
v2.name = '0.0'
v2.update()
updated_fields = self.ticket_system.get_ticket_fields()
updated_version_field = self._get_ticket_field('version')
self.assertNotEqual(fields, updated_fields)
self.assertEqual(['2.0', '1.0'], version_field['options'])
self.assertEqual(['1.0', '0.0'], updated_version_field['options'])
def test_get_ticket_fields_version_update_time(self):
"""Cached ticket fields are updated when version release time
is changed.
"""