当前位置: 首页>>代码示例>>Python>>正文


Python batch.BatchModifyModule类代码示例

本文整理汇总了Python中trac.ticket.batch.BatchModifyModule的典型用法代码示例。如果您正苦于以下问题:Python BatchModifyModule类的具体用法?Python BatchModifyModule怎么用?Python BatchModifyModule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BatchModifyModule类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_ignore_summary_reporter_and_description

 def test_ignore_summary_reporter_and_description(self):
     """These cannot be added through the UI, but if somebody tries
     to build their own POST data they will be ignored."""
     batch = BatchModifyModule(self.env)
     self.req.args = {}
     self.req.args['batchmod_value_summary'] = 'test ticket'
     self.req.args['batchmod_value_reporter'] = 'anonymous'
     self.req.args['batchmod_value_description'] = 'synergize the widgets'
     values = batch._get_new_ticket_values(self.req)
     self.assertEqual(len(values), 0)
开发者ID:thimalk,项目名称:bloodhound,代码行数:10,代码来源:batch.py

示例2: test_save_comment

    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')
开发者ID:pkdevbox,项目名称:trac,代码行数:12,代码来源:batch.py

示例3: test_save_values

    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')
开发者ID:pkdevbox,项目名称:trac,代码行数:14,代码来源:batch.py

示例4: test_action_with_state_change

    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')
开发者ID:pkdevbox,项目名称:trac,代码行数:15,代码来源:batch.py

示例5: test_action_with_side_effects

    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')
开发者ID:pkdevbox,项目名称:trac,代码行数:18,代码来源:batch.py

示例6: test_timeline_events

    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))
开发者ID:pkdevbox,项目名称:trac,代码行数:42,代码来源:batch.py

示例7: test_selected_tickets

 def test_selected_tickets(self):
     self.req.args = {'selected_tickets': '1,2,3'}
     batch = BatchModifyModule(self.env)
     selected_tickets = batch._get_selected_tickets(self.req)
     self.assertEqual(selected_tickets, ['1', '2', '3'])
开发者ID:pkdevbox,项目名称:trac,代码行数:5,代码来源:batch.py

示例8: test_add_batchmod_value_data_from_request

 def test_add_batchmod_value_data_from_request(self):
     batch = BatchModifyModule(self.env)
     self.req.args = {'batchmod_value_milestone': 'milestone1'}
     values = batch._get_new_ticket_values(self.req)
     self.assertEqual(values['milestone'], 'milestone1')
开发者ID:pkdevbox,项目名称:trac,代码行数:5,代码来源:batch.py

示例9: _change_list_test_helper

 def _change_list_test_helper(self, original, new, new2, mode):
     batch = BatchModifyModule(self.env)
     return batch._change_list(original, new, new2, mode)
开发者ID:pkdevbox,项目名称:trac,代码行数:3,代码来源:batch.py

示例10: test_no_selected_tickets

 def test_no_selected_tickets(self):
     """If nothing is selected, the return value is the empty list."""
     self.req.args = {'selected_tickets': ''}
     batch = BatchModifyModule(self.env)
     selected_tickets = batch._get_selected_tickets(self.req)
     self.assertEqual(selected_tickets, [])
开发者ID:pkdevbox,项目名称:trac,代码行数:6,代码来源:batch.py


注:本文中的trac.ticket.batch.BatchModifyModule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。