示例#1
0
 def test_load_roadmap_maintains_story_order(self):
     """
     L{load_roadmap} creates a L{Roadmap} with L{Story}s in a L{TimePeriod}
     in the same order they're represented in the JSON document.
     """
     json = dumps({"project": "project-name",
                   "time_periods": [
                       {"name": "time-period-1",
                        "start_date": "2011-01-01",
                        "end_date": "2011-01-31",
                        "stories": [
                            {"name": "story-1",
                             "description": "story-description1",
                             "track": "story-track1",
                             "status": "In progress"},
                            {"name": "story-2",
                             "description": "story-description2",
                             "track": "story-track2",
                             "status": "In progress"}]}]})
     roadmap = load_roadmap(json)
     self.assertEqual("project-name", roadmap.project)
     [time_period] = roadmap.time_periods
     [story1, story2] = time_period.stories
     self.assertEqual("story-1", story1.name)
     self.assertEqual("story-2", story2.name)
示例#2
0
 def test_load_roadmap(self):
     """
     L{load_roadmap} creates a L{Roadmap} with L{TimePeriod}s and L{Stories}
     from a JSON document.
     """
     json = dumps({"project": "project-name",
                   "time_periods": [
                       {"name": "time-period-name",
                        "start_date": "2011-01-29",
                        "end_date": "2011-02-28",
                        "stories": [
                            {"name": "story-name",
                             "description": "story-description",
                             "track": "story-track",
                             "status": "In progress"}]}]})
     roadmap = load_roadmap(json)
     self.assertEqual("project-name", roadmap.project)
     [time_period] = roadmap.time_periods
     self.assertEqual("time-period-name", time_period.name)
     self.assertEqual(datetime(2011, 1, 29), time_period.start_date)
     self.assertEqual(datetime(2011, 2, 28), time_period.end_date)
     [story] = time_period.stories
     self.assertEqual("story-name", story.name)
     self.assertEqual("story-description", story.description)
     self.assertEqual("story-track", story.track)
     self.assertEqual("In progress", story.status)
示例#3
0
 def test_load_empty_roadmap(self):
     """
     L{load_roadmap} creates an empty L{Roadmap} if no time period data is
     provided.
     """
     json = dumps({"project": "project-name", "time_periods": []})
     roadmap = load_roadmap(json)
     self.assertEqual("project-name", roadmap.project)
     self.assertEqual([], roadmap.time_periods)
示例#4
0
 def test_load_roadmap_maintains_time_period_order(self):
     """
     L{load_roadmap} creates a L{Roadmap} with L{TimePeriod}s in the same
     order they're represented in the JSON document.
     """
     json = dumps({"project": "project-name",
                   "time_periods": [
                       {"name": "time-period-1",
                        "start_date": "2011-01-01",
                        "end_date": "2011-01-31",
                        "stories": []},
                       {"name": "time-period-2",
                        "start_date": "2011-02-01",
                        "end_date": "2011-02-28",
                        "stories": []}]})
     roadmap = load_roadmap(json)
     self.assertEqual("project-name", roadmap.project)
     [time_period1, time_period2] = roadmap.time_periods
     self.assertEqual("time-period-1", time_period1.name)
     self.assertEqual("time-period-2", time_period2.name)
示例#5
0
文件: commands.py 项目: jkakar/kanban
 def run(self, roadmap_json_path, output_file=None):
     with open(roadmap_json_path, "r") as file:
         json = file.read()
     roadmap = load_roadmap(json)
     self.write_output(generate_roadmap_html(roadmap), output_file)