本文整理汇总了Python中trac.ticket.api.TicketSystem.get_ticket_changes方法的典型用法代码示例。如果您正苦于以下问题:Python TicketSystem.get_ticket_changes方法的具体用法?Python TicketSystem.get_ticket_changes怎么用?Python TicketSystem.get_ticket_changes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.ticket.api.TicketSystem
的用法示例。
在下文中一共展示了TicketSystem.get_ticket_changes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ResetActionTestCase
# 需要导入模块: from trac.ticket.api import TicketSystem [as 别名]
# 或者: from trac.ticket.api.TicketSystem import get_ticket_changes [as 别名]
class ResetActionTestCase(unittest.TestCase):
def setUp(self):
self.env = EnvironmentStub(default_data=True)
self.perm_sys = PermissionSystem(self.env)
self.ctlr = TicketSystem(self.env).action_controllers[0]
self.req1 = Mock(authname='user1', args={},
perm=PermissionCache(self.env, 'user1'))
self.req2 = Mock(authname='user2', args={},
perm=PermissionCache(self.env, 'user2'))
self.ticket = Ticket(self.env)
self.ticket['status'] = 'invalid'
self.ticket.insert()
def tearDown(self):
self.env.reset_db()
def _reload_workflow(self):
self.ctlr.actions = self.ctlr.get_all_actions()
def test_default_reset_action(self):
"""Default reset action."""
self.perm_sys.grant_permission('user2', 'TICKET_ADMIN')
self._reload_workflow()
actions1 = self.ctlr.get_ticket_actions(self.req1, self.ticket)
actions2 = self.ctlr.get_ticket_actions(self.req2, self.ticket)
chgs2 = self.ctlr.get_ticket_changes(self.req2, self.ticket, '_reset')
self.assertEqual(1, len(actions1))
self.assertNotIn((0, '_reset'), actions1)
self.assertEqual(2, len(actions2))
self.assertIn((0, '_reset'), actions2)
self.assertEqual('new', chgs2['status'])
def test_custom_reset_action(self):
"""Custom reset action in [ticket-workflow] section."""
config = self.env.config['ticket-workflow']
config.set('_reset', '-> review')
config.set('_reset.operations', 'reset_workflow')
config.set('_reset.permissions', 'TICKET_BATCH_MODIFY')
config.set('_reset.default', 2)
self.perm_sys.grant_permission('user2', 'TICKET_BATCH_MODIFY')
self._reload_workflow()
actions1 = self.ctlr.get_ticket_actions(self.req1, self.ticket)
actions2 = self.ctlr.get_ticket_actions(self.req2, self.ticket)
chgs2 = self.ctlr.get_ticket_changes(self.req2, self.ticket, '_reset')
self.assertEqual(1, len(actions1))
self.assertNotIn((2, '_reset'), actions1)
self.assertEqual(2, len(actions2))
self.assertIn((2, '_reset'), actions2)
self.assertEqual('review', chgs2['status'])