def test_team_commitment(self): """Tests store and retrieval of the team commitment of a sprint""" test_team = self.tm.create(name="Team#1") sprint = self.teh.create_sprint("TestSprint", team=test_team) self.assert_true(test_team.exists) # Set the initial USP/RT ratio to 2 tm = TeamMetrics(self.env, sprint, test_team) tm[Key.RT_USP_RATIO] = 2 tm.save() tm1 = self.tmm.create(name="Member#1", team=test_team) self.tmm.create(name="Member#2", team=test_team) self.tmm.create(name="Member#3", team=test_team) us1 = self.teh.create_ticket(Type.USER_STORY, props={Key.STORY_POINTS: '5', Key.SPRINT: sprint.name}) us2 = self.teh.create_ticket(Type.USER_STORY, props={Key.STORY_POINTS: '8', Key.SPRINT: sprint.name}) t1 = self.teh.create_ticket(Type.TASK, props={Key.REMAINING_TIME: '12', Key.OWNER: tm1.name, Key.SPRINT: sprint.name}) # This task is not explicitly planned for the sprint, but because it is # linked should be calculated t2 = self.teh.create_ticket(Type.TASK, props={Key.REMAINING_TIME: '8', Key.OWNER: tm1.name}) # Make sure there is a remaining time entry on the first day of the sprint RemainingTime(self.env, t1).set_remaining_time(t1[Key.REMAINING_TIME], sprint.start) RemainingTime(self.env, t2).set_remaining_time(t2[Key.REMAINING_TIME], sprint.start) us1.link_to(t1) us1.link_to(t2) us2 = self.teh.load_ticket(ticket=us2) self.assert_equals(Type.USER_STORY, us2.get_type()) self.assert_not_none(us2._calculated) # check the estimated remaining time for us2 self.assert_equals(8 * 2, us2[Key.ESTIMATED_REMAINING_TIME]) cmd_class = TeamController.CalculateAndStoreTeamCommitmentCommand cmd_store_commitment = cmd_class(self.env, sprint=sprint, team=test_team) commitment = TeamController(self.env).process_command(cmd_store_commitment) self.assert_equals(12 + 8 * 2, commitment) cmd_get_commitment = TeamController.GetTeamCommitmentCommand(self.env, sprint=sprint, team=test_team) self.assert_equals(commitment, self.controller.process_command(cmd_get_commitment))
def test_get_team_metrics_command_returns_none_if_no_team_given(self): sprint_without_team = self.teh.create_sprint('FooSprint') cmd = TeamController.GetTeamCommitmentCommand(self.env, sprint=sprint_without_team) commitment = TeamController(self.env).process_command(cmd) self.assert_none(commitment)
def _commitment(self, sprint, team): cmd = TeamController.GetTeamCommitmentCommand(self.env, sprint=sprint, team=team) commitment = TeamController(self.env).process_command(cmd) return commitment
def get_commitment(self, team, sprint): cmd = TeamController.GetTeamCommitmentCommand(self.env, sprint=sprint, team=team) return TeamController(self.env).process_command(cmd)