本文整理汇总了Python中trac.ticket.Milestone.update方法的典型用法代码示例。如果您正苦于以下问题:Python Milestone.update方法的具体用法?Python Milestone.update怎么用?Python Milestone.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trac.ticket.Milestone
的用法示例。
在下文中一共展示了Milestone.update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_milestone
# 需要导入模块: from trac.ticket import Milestone [as 别名]
# 或者: from trac.ticket.Milestone import update [as 别名]
def test_milestone(self):
milestone = Milestone(self.env)
milestone.name = 'New target date'
milestone.description = 'Lorem ipsum dolor sit amet'
milestone.insert()
so = self._get_so()
self.assertEquals('%s:milestone:New target date' % self.basename,
so.doc_id)
self.assertEquals('milestone', so.realm),
self.assertEquals('New target date', so.id)
self.assertTrue('New target date' in so.title)
self.assertTrue('Lorem ipsum' in so.title)
self.assertTrue('Lorem ipsum' in so.oneline)
self.assertTrue('Lorem ipsum' in so.body)
milestone.description = 'No latin filler here'
milestone.due = datetime(2001, 01, 01, tzinfo=utc)
milestone.update()
so = self._get_so()
self.assertEquals('%s:milestone:New target date' % self.basename,
so.doc_id)
self.assertEquals('milestone', so.realm),
self.assertEquals('New target date', so.id)
self.assertEquals(milestone.due, so.changed)
self.assertFalse('Lorem ipsum' in so.body)
self.assertTrue('No latin filler here' in so.body)
示例2: change_milestone
# 需要导入模块: from trac.ticket import Milestone [as 别名]
# 或者: from trac.ticket.Milestone import update [as 别名]
def change_milestone(self, name_to_change, name=None, description=None):
milestone = Milestone(self.env, name_to_change)
if name is not None:
milestone.name = name
if description is not None:
milestone.description = description
milestone.update()
return milestone
示例3: testMilestoneRenamePropagatesToSprints
# 需要导入模块: from trac.ticket import Milestone [as 别名]
# 或者: from trac.ticket.Milestone import update [as 别名]
def testMilestoneRenamePropagatesToSprints(self):
"""Tests that the rename of a Milestone, propagates to the Sprints, this
is an AgiloMilestone feature"""
m = Milestone(self.env)
m.name = 'test_me'
m.insert()
s = self.teh.create_sprint('my sprint', milestone=m.name)
self.assert_equals(m.name, s.milestone)
# AT: we need to reload the milestone as there is a problem in trac,
# that the insert is not updating the _old_name, making the update
# silently fail. I sent a patch for this
m = Milestone(self.env, m.name)
m.name = 'test_me_not'
m.update()
smm = SprintModelManager(self.env)
smm.get_cache().invalidate()
s = smm.get(name=s.name)
self.assert_equals(m.name, s.milestone)
示例4: test_can_save_due_date
# 需要导入模块: from trac.ticket import Milestone [as 别名]
# 或者: from trac.ticket.Milestone import update [as 别名]
def test_can_save_due_date(self):
# Added when Trac 0.12 was released as the format of the timestamp has changed in 0.12
milestone = Milestone(self.env)
milestone.name = 'fnord'
milestone.insert()
# in trac 0.11.1, milestone._old_name is not set to "fnord" at
# insert() time, only on init() or update()
# so we need to reload the object to be able to run update() on it
milestone = Milestone(self.env, name='fnord')
expected_time = now().replace(microsecond=0)
milestone.due = expected_time
milestone.completed = expected_time
milestone.update()
loaded_milestone = Milestone(self.env, name='fnord')
self.assert_equals(expected_time, loaded_milestone.due)
self.assert_equals(expected_time, loaded_milestone.completed)
示例5: testMilestoneRenamePropagatesToTickets
# 需要导入模块: from trac.ticket import Milestone [as 别名]
# 或者: from trac.ticket.Milestone import update [as 别名]
def testMilestoneRenamePropagatesToTickets(self):
"""Tests that the Milestone renaming is propagated to the tickets, this
should work out of the box, as it is a Trac feature"""
m = Milestone(self.env)
m.name = 'test_me'
m.insert()
t = self.teh.create_ticket(Type.REQUIREMENT, {Key.MILESTONE: m.name})
self.assert_equals(m.name, t[Key.MILESTONE])
# AT: we need to reload the milestone as there is a problem in trac,
# that the insert is not updating the _old_name, making the update
# silently fail. I sent a patch for this
m = Milestone(self.env, m.name)
m.name = 'test_me_not'
m.update()
# test the changes happened in the DB
db = self.env.get_db_cnx()
cursor = db.cursor()
cursor.execute("SELECT id, milestone FROM ticket WHERE milestone='test_me'")
for row in cursor:
self.fail("Found one old milestone in ticket: #%s (%s)" % \
(row[0], row[1]))
t = self.teh.load_ticket(t)
self.assert_equals(m.name, t[Key.MILESTONE])