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


Python Milestone.insert方法代码示例

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


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

示例1: test_create_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import insert [as 别名]
    def test_create_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())
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:11,代码来源:model.py

示例2: milestone_setup

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import insert [as 别名]
def milestone_setup(tc):
    from datetime import datetime
    from trac.util.datefmt import utc
    boo = Milestone(tc.env)
    boo.name = 'boo'
    boo.completed = boo.due = None
    boo.insert()
    roo = Milestone(tc.env)
    roo.name = 'roo'
    roo.completed = datetime.now(utc)
    roo.due = None
    roo.insert()
开发者ID:dafrito,项目名称:trac-mirror,代码行数:14,代码来源:wikisyntax.py

示例3: test_create_and_update_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import insert [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

示例4: test_create_and_update_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import insert [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

示例5: testBacklogForMultipleSprint

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import insert [as 别名]
 def testBacklogForMultipleSprint(self):
     """Tests a Backlog associated to a Sprint with multiple sprints"""
     # Creates a Milestone
     m = Milestone(self.env)
     m.name = "Milestone 1"
     m.insert()
     # Create 2 Sprints
     sprint1 = self.teh.create_sprint(
                      name="Sprint 1", 
                      start=to_datetime(t=None), 
                      duration=20,
                      milestone=m.name)
     sprint2 = self.teh.create_sprint( 
                      name="Sprint 2", 
                      start=to_datetime(t=None), 
                      duration=20,
                      milestone=m.name)
     # Create some tickets
     s1 = self.teh.create_ticket(Type.USER_STORY, 
                                 props={Key.STORY_POINTS: '3', 
                                        Key.SPRINT: sprint1.name})
     self.assert_true(s1.link_to(self.teh.create_ticket(Type.TASK, 
                                                        props={Key.REMAINING_TIME: '4',
                                                               Key.SPRINT: sprint1.name})))
     self.assert_true(s1.link_to(self.teh.create_ticket(Type.TASK,
                                                        props={Key.REMAINING_TIME: '8',
                                                               Key.SPRINT: sprint1.name})))
     self.assert_true(s1.link_to(self.teh.create_ticket(Type.TASK, 
                                                        props={Key.REMAINING_TIME: '4'})))
     s2 = self.teh.create_ticket(Type.USER_STORY, props={Key.STORY_POINTS: '5', 
                                                         Key.SPRINT: sprint2.name})
     self.assert_true(s2.link_to(self.teh.create_ticket(Type.TASK, 
                                                        props={Key.REMAINING_TIME: '2',
                                                               Key.SPRINT: sprint2.name})))
     self.assert_true(s2.link_to(self.teh.create_ticket(Type.TASK, 
                                                        props={Key.REMAINING_TIME: '3'})))
     # Creates the Backlog bound to the Sprint
     backlog = BacklogConfiguration(self.env, name="Sprint-Backlog", type=BacklogType.SPRINT)
     backlog.ticket_types = [Type.USER_STORY, Type.TASK]
     backlog.save()
     # The Backlog should contains only the items planned for the Sprint, and with parents
     # planned for the Sprint too
     backlog1 =  self.bmm.get(name="Sprint-Backlog", scope=sprint1.name)
     self.assert_length(3, backlog1)
     backlog2 =  self.bmm.get(name="Sprint-Backlog", scope=sprint2.name)
     self.assert_length(2, backlog2)
开发者ID:djangsters,项目名称:agilo,代码行数:48,代码来源:backlog_test.py

示例6: task

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import insert [as 别名]
 def task(add):
     """the thread task - either we are discovering or adding events"""
     with lock:
         env = ProductEnvironment(self.global_env,
                                  self.default_product)
         if add:
             name = 'milestone_from_' + threading.current_thread().name
             milestone = Milestone(env)
             milestone.name = name
             milestone.insert()
         else:
             # collect the names of milestones reported by Milestone and
             # directly from the db - as sets to ease comparison later
             results.append({
                 'from_t': set([m.name for m in Milestone.select(env)]),
                 'from_db': set(
                     [v[0] for v in self.env.db_query(
                         "SELECT name FROM milestone")])})
开发者ID:mohsadki,项目名称:dargest,代码行数:20,代码来源:model.py

示例7: test_rename_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import insert [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

示例8: test_rename_milestone

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import insert [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

示例9: milestone_setup

# 需要导入模块: from trac.ticket.model import Milestone [as 别名]
# 或者: from trac.ticket.model.Milestone import insert [as 别名]
def milestone_setup(tc):
    boo = Milestone(tc.env)
    boo.name = 'boo'
    boo.completed = boo.due = None
    boo.insert()
    roo = Milestone(tc.env)
    roo.name = 'roo'
    roo.completed = dt_past
    roo.due = None
    roo.insert()
    woo = Milestone(tc.env)
    woo.name = 'woo'
    woo.completed = None
    woo.due = dt_future
    woo.insert()
    zoo = Milestone(tc.env)
    zoo.name = 'zoo'
    zoo.completed = None
    zoo.due = dt_past
    zoo.insert()
开发者ID:exocad,项目名称:exotrac,代码行数:22,代码来源:wikisyntax.py


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