Example #1
0
 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)
Example #2
0
    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'
            """
            ),
        )
Example #3
0
    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())
Example #4
0
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()
Example #5
0
    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())
Example #6
0
    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)
Example #7
0
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()