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


Python Milestone.update方法代码示例

本文整理汇总了Python中trac.ticket.model.Milestone.update方法的典型用法代码示例。如果您正苦于以下问题:Python Milestone.update方法的具体用法?Python Milestone.update怎么用?Python Milestone.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trac.ticket.model.Milestone的用法示例。


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

示例1: test_reset_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import update [as 别名]
    def test_reset_milestone(self):
        self.env.config.set('ticket', 'workflow',
            'ConfigurableTicketWorkflow,TicketWorkflowOpResetMilestone')
        self._config_set('ticket-workflow', [
            ('reset-milestone', '* -> *'),
            ('reset-milestone.operations', 'reset_milestone'),
        ])
        tktid = self._insert_ticket(when=datetime(2017, 3, 9, tzinfo=utc),
                                    summary='reset milestone',
                                    milestone='milestone1',
                                    reporter='anonymous', owner='joe')

        ticket = Ticket(self.env, tktid)
        req = self._post_req('reset-milestone', ticket)
        self.assertTrue(self.tktmod.match_request(req))
        self.assertRaises(RequestDone, self.tktmod.process_request, req)
        ticket = Ticket(self.env, tktid)
        self.assertEqual('milestone1', ticket['milestone'])

        milestone = Milestone(self.env, ticket['milestone'])
        milestone.completed = datetime(2017, 3, 8, tzinfo=utc)
        milestone.update()
        req = self._post_req('reset-milestone', ticket)
        self.assertTrue(self.tktmod.match_request(req))
        self.assertRaises(RequestDone, self.tktmod.process_request, req)
        ticket = Ticket(self.env, tktid)
        self.assertEqual('', ticket['milestone'])

        ticket['milestone'] = 'unknown-milestone'
        ticket.save_changes(when=datetime(2017, 3, 8, 1, tzinfo=utc))
        req = self._post_req('reset-milestone', ticket)
        self.assertTrue(self.tktmod.match_request(req))
        self.assertRaises(RequestDone, self.tktmod.process_request, req)
        ticket = Ticket(self.env, tktid)
        self.assertEqual('unknown-milestone', ticket['milestone'])
开发者ID:aroth-arsoft,项目名称:trac-advancedworkflow,代码行数:37,代码来源:controller.py

示例2: ticket_changed

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import update [as 别名]
 def ticket_changed(self, ticket, comment, author, old_values):
     old_summary = old_values.get('summary')
     if ticket['type']==milestone_ticket_type \
         and old_summary \
         and ticket['summary'] != old_summary:
             try:
                 milestone = Milestone(self.env, old_summary)
                 if milestone.exists:
                     milestone.name = ticket['summary']
                     milestone.update()
             except ResourceNotFound:
                 pass
开发者ID:esogs,项目名称:IttecoTracPlugin,代码行数:14,代码来源:roadmap.py

示例3: test_update_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import update [as 别名]
    def test_update_milestone(self):
        cursor = self.db.cursor()
        cursor.execute("INSERT INTO milestone (name) VALUES ('Test')")
        cursor.close()

        milestone = Milestone(self.env, 'Test')
        milestone.due = 42
        milestone.completed = 43
        milestone.description = 'Foo bar'
        milestone.update()

        cursor = self.db.cursor()
        cursor.execute("SELECT * FROM milestone WHERE name='Test'")
        self.assertEqual(('Test', 42, 43, 'Foo bar'), cursor.fetchone())
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:16,代码来源:model.py

示例4: test_update_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import update [as 别名]
    def test_update_milestone(self):
        self.env.db_transaction("INSERT INTO milestone (name) VALUES ('Test')")

        milestone = Milestone(self.env, 'Test')
        t1 = datetime(2001, 01, 01, tzinfo=utc)
        t2 = datetime(2002, 02, 02, tzinfo=utc)
        milestone.due = t1
        milestone.completed = t2
        milestone.description = 'Foo bar'
        milestone.update()

        self.assertEqual(
            [('Test', to_utimestamp(t1), to_utimestamp(t2), 'Foo bar')],
            self.env.db_query("SELECT * FROM milestone WHERE name='Test'"))
开发者ID:thimalk,项目名称:bloodhound,代码行数:16,代码来源:model.py

示例5: test_create_and_update_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import update [as 别名]
    def test_create_and_update_milestone(self):
        milestone = Milestone(self.env)
        milestone.name = "Test"
        milestone.insert()

        cursor = self.db.cursor()
        cursor.execute("SELECT name,due,completed,description FROM milestone " "WHERE name='Test'")
        self.assertEqual(("Test", 0, 0, ""), cursor.fetchone())

        # Use the same model object to update the milestone
        milestone.description = "Some text"
        milestone.update()
        cursor.execute("SELECT name,due,completed,description FROM milestone " "WHERE name='Test'")
        self.assertEqual(("Test", 0, 0, "Some text"), cursor.fetchone())
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:16,代码来源:model.py

示例6: test_update_milestone_update_tickets

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import update [as 别名]
    def test_update_milestone_update_tickets(self):
        self.env.db_transaction("INSERT INTO milestone (name) VALUES ('Test')")

        tkt1 = Ticket(self.env)
        tkt1.populate({'summary': 'Foo', 'milestone': 'Test'})
        tkt1.insert()
        tkt2 = Ticket(self.env)
        tkt2.populate({'summary': 'Bar', 'milestone': 'Test'})
        tkt2.insert()

        milestone = Milestone(self.env, 'Test')
        milestone.name = 'Testing'
        milestone.update()

        self.assertEqual('Testing', Ticket(self.env, tkt1.id)['milestone'])
        self.assertEqual('Testing', Ticket(self.env, tkt2.id)['milestone'])
开发者ID:thimalk,项目名称:bloodhound,代码行数:18,代码来源:model.py

示例7: test_update_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import update [as 别名]
    def test_update_milestone(self):
        cursor = self.db.cursor()
        cursor.execute("INSERT INTO milestone (name) VALUES ('Test')")
        cursor.close()

        milestone = Milestone(self.env, "Test")
        t1 = datetime(2001, 01, 01, tzinfo=utc)
        t2 = datetime(2002, 02, 02, tzinfo=utc)
        milestone.due = t1
        milestone.completed = t2
        milestone.description = "Foo bar"
        milestone.update()

        cursor = self.db.cursor()
        cursor.execute("SELECT * FROM milestone WHERE name='Test'")
        self.assertEqual(("Test", to_utimestamp(t1), to_utimestamp(t2), "Foo bar"), cursor.fetchone())
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:18,代码来源:model.py

示例8: test_create_and_update_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import update [as 别名]
    def test_create_and_update_milestone(self):
        milestone = Milestone(self.env)
        milestone.name = 'Test'
        milestone.insert()

        self.assertEqual([('Test', 0, 0, '')], self.env.db_query("""
            SELECT name, due, completed, description FROM milestone
            WHERE name='Test'
            """))

        # Use the same model object to update the milestone
        milestone.description = 'Some text'
        milestone.update()
        self.assertEqual([('Test', 0, 0, 'Some text')], self.env.db_query("""
            SELECT name, due, completed, description FROM milestone
            WHERE name='Test'
            """))
开发者ID:thimalk,项目名称:bloodhound,代码行数:19,代码来源:model.py

示例9: test_update_milestone_update_tickets

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import update [as 别名]
    def test_update_milestone_update_tickets(self):
        cursor = self.db.cursor()
        cursor.execute("INSERT INTO milestone (name) VALUES ('Test')")
        cursor.close()

        tkt1 = Ticket(self.env)
        tkt1.populate({'summary': 'Foo', 'milestone': 'Test'})
        tkt1.insert()
        tkt2 = Ticket(self.env)
        tkt2.populate({'summary': 'Bar', 'milestone': 'Test'})
        tkt2.insert()

        milestone = Milestone(self.env, 'Test')
        milestone.name = 'Testing'
        milestone.update()

        self.assertEqual('Testing', Ticket(self.env, tkt1.id)['milestone'])
        self.assertEqual('Testing', Ticket(self.env, tkt2.id)['milestone'])
开发者ID:zjj,项目名称:trac_hack,代码行数:20,代码来源:model.py

示例10: test_get_ticket_fields_milestone_rename

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import update [as 别名]
    def test_get_ticket_fields_milestone_rename(self):
        """Cached ticket fields are updated when milestone is renamed."""
        fields = self.ticket_system.get_ticket_fields()
        milestone_field = self._get_ticket_field('milestone')
        m2 = Milestone(self.env, 'milestone2')
        m2.name = 'milestone5'

        m2.update()
        updated_fields = self.ticket_system.get_ticket_fields()
        updated_milestone_field = self._get_ticket_field('milestone')

        self.assertNotEqual(fields, updated_fields)
        self.assertEqual(['milestone1', 'milestone2',
                          'milestone3', 'milestone4'],
                         milestone_field['options'])
        self.assertEqual(['milestone1', 'milestone3',
                          'milestone4', 'milestone5'],
                         updated_milestone_field['options'])
开发者ID:pkdevbox,项目名称:trac,代码行数:20,代码来源:api.py

示例11: test_rename_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import update [as 别名]
    def test_rename_milestone(self):
        milestone = Milestone(self.env)
        milestone.name = 'OldName'
        milestone.insert()
        
        attachment = Attachment(self.env, 'milestone', 'OldName')
        attachment.insert('foo.txt', StringIO(), 0, 1)
        
        milestone = Milestone(self.env, 'OldName')
        milestone.name = 'NewName'
        milestone.update()
        
        self.assertRaises(ResourceNotFound, Milestone, self.env, 'OldName')
        self.assertEqual('NewName', Milestone(self.env, 'NewName').name)

        attachments = Attachment.select(self.env, 'milestone', 'OldName')
        self.assertRaises(StopIteration, attachments.next)
        attachments = Attachment.select(self.env, 'milestone', 'NewName')
        self.assertEqual('foo.txt', attachments.next().filename)
        self.assertRaises(StopIteration, attachments.next)
开发者ID:zjj,项目名称:trac_hack,代码行数:22,代码来源:model.py

示例12: test_get_ticket_fields_milestone_update_due

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import update [as 别名]
    def test_get_ticket_fields_milestone_update_due(self):
        """Cached ticket fields are updated when milestone due date is
        changed.
        """
        fields = self.ticket_system.get_ticket_fields()
        milestone_field = self._get_ticket_field('milestone')
        m2 = Milestone(self.env, 'milestone2')
        m2.due = datetime.now(utc)

        m2.update()
        updated_fields = self.ticket_system.get_ticket_fields()
        updated_milestone_field = self._get_ticket_field('milestone')

        self.assertNotEqual(fields, updated_fields)
        self.assertEqual(['milestone1', 'milestone2',
                          'milestone3', 'milestone4'],
                         milestone_field['options'])
        self.assertEqual(['milestone2', 'milestone1',
                          'milestone3', 'milestone4'],
                         updated_milestone_field['options'])
开发者ID:pkdevbox,项目名称:trac,代码行数:22,代码来源:api.py

示例13: test_rename_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import update [as 别名]
    def test_rename_milestone(self):
        milestone = Milestone(self.env)
        milestone.name = "OldName"
        milestone.insert()

        attachment = Attachment(self.env, "milestone", "OldName")
        attachment.insert("foo.txt", StringIO(), 0, 1)

        milestone = Milestone(self.env, "OldName")
        milestone.name = "NewName"
        milestone.update()

        self.assertRaises(ResourceNotFound, Milestone, self.env, "OldName")
        self.assertEqual("NewName", Milestone(self.env, "NewName").name)

        attachments = Attachment.select(self.env, "milestone", "OldName")
        self.assertRaises(StopIteration, attachments.next)
        attachments = Attachment.select(self.env, "milestone", "NewName")
        self.assertEqual("foo.txt", attachments.next().filename)
        self.assertRaises(StopIteration, attachments.next)
开发者ID:wiraqutra,项目名称:photrackjp,代码行数:22,代码来源:model.py


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