Example #1
0
 def test_add(self):
     """L{TimePeriod.add} adds a L{Story} to a time period."""
     start_date = datetime.utcnow()
     end_date = start_date + timedelta(days=30)
     time_period = TimePeriod("name", start_date, end_date)
     story = Story("name", "description", "track", QUEUED)
     time_period.add(story)
     self.assertEqual([story], time_period.stories)
Example #2
0
 def test_get_stories_by_track_without_matches(self):
     """
     L{TimePeriod.get_stories_by_track} returns an empty C{list} if no
     L{Story}s match the specified track.
     """
     start_date = datetime.utcnow()
     end_date = start_date + timedelta(days=30)
     time_period = TimePeriod("name", start_date, end_date)
     time_period.add(Story("name", "description", "track1", QUEUED))
     self.assertEqual([], time_period.get_stories_by_track("track2"))
Example #3
0
 def test_tracks(self):
     """
     The tracks exposed with the L{TimePeriod.tracks} property are sorted
     by name.
     """
     start_date = datetime.utcnow()
     end_date = start_date + timedelta(days=30)
     time_period = TimePeriod("name", start_date, end_date)
     time_period.add(Story("name1", "description", "track2", QUEUED))
     time_period.add(Story("name2", "description", "track1", QUEUED))
     self.assertEqual(["track1", "track2"], time_period.tracks)
Example #4
0
 def test_get_stories_by_track(self):
     """
     L{TimePeriod.get_stories_by_track} returns all L{Story}s in the time
     period that are in the specified track.  The stories are returned in
     the order they were added to the time period.
     """
     start_date = datetime.utcnow()
     end_date = start_date + timedelta(days=30)
     time_period = TimePeriod("name", start_date, end_date)
     time_period.add(Story("name", "description", "track2", QUEUED))
     story1 = Story("name1", "description", "track1", QUEUED)
     story2 = Story("name2", "description", "track1", QUEUED)
     time_period.add(story1)
     time_period.add(story2)
     self.assertEqual([story1, story2],
                      time_period.get_stories_by_track("track1"))
Example #5
0
 def test_tracks(self):
     """
     The tracks exposed with the L{Roadmap.tracks} property are sorted by
     name.
     """
     roadmap = Roadmap("project-name")
     start_date = datetime.utcnow()
     end_date = start_date + timedelta(days=30)
     time_period1 = TimePeriod("name1", start_date, end_date)
     time_period1.add(Story("name1", "description", "track1", QUEUED))
     time_period1.add(Story("name2", "description", "track2", QUEUED))
     time_period2 = TimePeriod("name2", start_date, end_date)
     time_period2.add(Story("name3", "description", "track3", QUEUED))
     roadmap.add(time_period1)
     roadmap.add(time_period2)
     self.assertEqual(["track1", "track2", "track3"],
                      roadmap.tracks)