本文整理汇总了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())
示例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()
示例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())
示例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'
"""))
示例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)
示例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")])})
示例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)
示例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)
示例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()