本文整理汇总了Python中trac.ticket.batch.BatchModifyModule._save_ticket_changes方法的典型用法代码示例。如果您正苦于以下问题:Python BatchModifyModule._save_ticket_changes方法的具体用法?Python BatchModifyModule._save_ticket_changes怎么用?Python BatchModifyModule._save_ticket_changes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.ticket.batch.BatchModifyModule
的用法示例。
在下文中一共展示了BatchModifyModule._save_ticket_changes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_save_comment
# 需要导入模块: from trac.ticket.batch import BatchModifyModule [as 别名]
# 或者: from trac.ticket.batch.BatchModifyModule import _save_ticket_changes [as 别名]
def test_save_comment(self):
"""Comments are saved to all selected tickets."""
first_ticket_id = self._insert_ticket('Test 1', reporter='joe')
second_ticket_id = self._insert_ticket('Test 2', reporter='joe')
selected_tickets = [first_ticket_id, second_ticket_id]
batch = BatchModifyModule(self.env)
batch._save_ticket_changes(self.req, selected_tickets, {}, 'comment',
'leave')
self.assertCommentAdded(first_ticket_id, 'comment')
self.assertCommentAdded(second_ticket_id, 'comment')
示例2: test_save_values
# 需要导入模块: from trac.ticket.batch import BatchModifyModule [as 别名]
# 或者: from trac.ticket.batch.BatchModifyModule import _save_ticket_changes [as 别名]
def test_save_values(self):
"""Changed values are saved to all tickets."""
first_ticket_id = self._insert_ticket('Test 1', reporter='joe',
component='foo')
second_ticket_id = self._insert_ticket('Test 2', reporter='joe')
selected_tickets = [first_ticket_id, second_ticket_id]
new_values = {'component': 'bar'}
batch = BatchModifyModule(self.env)
batch._save_ticket_changes(self.req, selected_tickets, new_values, '',
'leave')
self.assertFieldChanged(first_ticket_id, 'component', 'bar')
self.assertFieldChanged(second_ticket_id, 'component', 'bar')
示例3: test_action_with_state_change
# 需要导入模块: from trac.ticket.batch import BatchModifyModule [as 别名]
# 或者: from trac.ticket.batch.BatchModifyModule import _save_ticket_changes [as 别名]
def test_action_with_state_change(self):
"""Actions can have change status."""
self.env.config.set('ticket-workflow', 'embiggen', '* -> big')
first_ticket_id = self._insert_ticket('Test 1', reporter='joe',
status='small')
second_ticket_id = self._insert_ticket('Test 2', reporter='joe')
selected_tickets = [first_ticket_id, second_ticket_id]
batch = BatchModifyModule(self.env)
batch._save_ticket_changes(self.req, selected_tickets, {}, '',
'embiggen')
self.assertFieldChanged(first_ticket_id, 'status', 'big')
self.assertFieldChanged(second_ticket_id, 'status', 'big')
示例4: test_action_with_side_effects
# 需要导入模块: from trac.ticket.batch import BatchModifyModule [as 别名]
# 或者: from trac.ticket.batch.BatchModifyModule import _save_ticket_changes [as 别名]
def test_action_with_side_effects(self):
"""Actions can have operations with side effects."""
self.env.config.set('ticket-workflow', 'buckify', '* -> *')
self.env.config.set('ticket-workflow', 'buckify.operations',
'set_owner')
self.req.args = {'action_buckify_reassign_owner': 'buck'}
first_ticket_id = self._insert_ticket('Test 1', reporter='joe',
owner='foo')
second_ticket_id = self._insert_ticket('Test 2', reporter='joe')
selected_tickets = [first_ticket_id, second_ticket_id]
batch = BatchModifyModule(self.env)
batch._save_ticket_changes(self.req, selected_tickets, {}, '',
'buckify')
self.assertFieldChanged(first_ticket_id, 'owner', 'buck')
self.assertFieldChanged(second_ticket_id, 'owner', 'buck')
示例5: test_timeline_events
# 需要导入模块: from trac.ticket.batch import BatchModifyModule [as 别名]
# 或者: from trac.ticket.batch.BatchModifyModule import _save_ticket_changes [as 别名]
def test_timeline_events(self):
"""Regression test for #11288"""
tktmod = web_ui.TicketModule(self.env)
now = datetime.now(utc)
start = now - timedelta(hours=1)
stop = now + timedelta(hours=1)
events = tktmod.get_timeline_events(self.req, start, stop,
['ticket_details'])
self.assertEqual(True, all(ev[0] != 'batchmodify' for ev in events))
ids = []
for i in xrange(20):
ticket = Ticket(self.env)
ticket['summary'] = 'Ticket %d' % i
ids.append(ticket.insert())
ids.sort()
new_values = {'summary': 'batch updated ticket',
'owner': 'ticket11288', 'reporter': 'ticket11288'}
batch = BatchModifyModule(self.env)
batch._save_ticket_changes(self.req, ids, new_values, '', 'leave')
# shuffle ticket_change records
with self.env.db_transaction as db:
rows = db('SELECT * FROM ticket_change')
db.execute('DELETE FROM ticket_change')
rows = rows[0::4] + rows[1::4] + rows[2::4] + rows[3::4]
db.executemany('INSERT INTO ticket_change VALUES (%s)' %
','.join(('%s',) * len(rows[0])),
rows)
events = tktmod.get_timeline_events(self.req, start, stop,
['ticket_details'])
events = [ev for ev in events if ev[0] == 'batchmodify']
self.assertEqual(1, len(events))
batch_ev = events[0]
self.assertEqual('anonymous', batch_ev[2])
self.assertEqual(ids, sorted(batch_ev[3][0]))
self.assertEqual('updated', batch_ev[3][1])
context = web_context(self.req)
self.assertEqual(
self.req.href.query(id=','.join(str(t) for t in ids)),
tktmod.render_timeline_event(context, 'url', batch_ev))