Example #1
0
 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))
Example #2
0
    def testRenameSprint(self):
        """Tests the Sprint rename"""
        name = 'Test sprint name'
        sprint = self.manager.create(name=name, start=self.start, end=self.end)
        self.assert_true(sprint.exists)
        self.assert_equals(sprint.name, name)
        
        # create a ticket for this sprint
        t = self.teh.create_ticket(Type.USER_STORY, props={Key.SPRINT: name})
        # reload ticket
        self.assert_equals(t[Key.SPRINT], name)
        # create a metrics object
        team = self.teh.create_team(name='Testteam')
        metrics = TeamMetrics(self.env, sprint, team)
        metrics['test'] = 1.0
        metrics.save()

        # Rename the sprint
        new_name = 'New sprint name'
        sprint.name = new_name
        self.assert_true(self.manager.save(sprint))
        self.assert_equals(sprint.name, new_name)
        # Remove the sprint from the cache and reload it again
        self.manager.get_cache().invalidate(model_instance=sprint)
        # check new name after reload
        sprint = self.manager.get(name=new_name)
        self.assert_equals(sprint.name, new_name)

        t = self.teh.load_ticket(t_id=t.id)
        # sprint in ticket and metrics should be renamed as well
        self.assert_equals(t[Key.SPRINT], new_name)
        metrics = TeamMetrics(self.env, sprint, team)
        self.assert_equals(metrics.sprint, sprint)
        self.assert_equals(metrics['test'], 1.0)
        
        # Rename the sprint with some not allowed characters
        new_name = "That's my sprint!"
        sprint.name = new_name
        self.assert_true(sprint.save())
        self.assert_equals(sprint.name, new_name)

        # check new name after reload
        sprint = Sprint(self.env, name=new_name)
        self.assert_equals(sprint.name, new_name)
Example #3
0
 def fill(self, team_name, metric_names):
     # Charts are not allowed to import the model classes globally
     from agilo.scrum.metrics import TeamMetrics
     sprints = self.sp_manager.select( 
                             criteria={'team': team_name}, 
                             order_by=['%s' % Key.START])
     sprint_names = [sprint.name for sprint in sprints]
     metrics_by_sprint = dict([(s.name, TeamMetrics(self.env, sprint=s)) \
                               for s in sprints])
     metrics = self._get_metrics_data(metric_names, sprint_names, metrics_by_sprint)
     title = self._make_title(metric_names)
     self.data.update(
         dict(team_name=team_name, sprint_names=sprint_names,
              metrics=metrics, title=title))
Example #4
0
    def testRenameSprint(self):
        """Tests the Sprint rename"""
        name = 'Test sprint name'
        sprint = self.manager.create(name=name, start=self.start, end=self.end)
        self.assert_true(sprint.exists)
        self.assert_equals(sprint.name, name)

        # create a ticket for this sprint
        t = self.teh.create_ticket(Type.USER_STORY, props={Key.SPRINT: name})
        # reload ticket
        self.assert_equals(t[Key.SPRINT], name)
        # create a metrics object
        team = self.teh.create_team(name='Testteam')
        metrics = TeamMetrics(self.env, sprint, team)
        metrics['test'] = 1.0
        metrics.save()

        # Rename the sprint
        new_name = 'New sprint name'
        sprint.name = new_name
        self.assert_true(self.manager.save(sprint))
        self.assert_equals(sprint.name, new_name)
        # Remove the sprint from the cache and reload it again
        self.manager.get_cache().invalidate(model_instance=sprint)
        # check new name after reload
        sprint = self.manager.get(name=new_name)
        self.assert_equals(sprint.name, new_name)

        t = self.teh.load_ticket(t_id=t.id)
        # sprint in ticket and metrics should be renamed as well
        self.assert_equals(t[Key.SPRINT], new_name)
        metrics = TeamMetrics(self.env, sprint, team)
        self.assert_equals(metrics.sprint, sprint)
        self.assert_equals(metrics['test'], 1.0)

        # Rename the sprint with some not allowed characters
        new_name = "That's my sprint!"
        sprint.name = new_name
        self.assert_true(sprint.save())
        self.assert_equals(sprint.name, new_name)

        # check new name after reload
        sprint = Sprint(self.env, name=new_name)
        self.assert_equals(sprint.name, new_name)
Example #5
0
 def _add_metrics(self, sprint, **data):
     metrics = TeamMetrics(self.env, sprint, sprint.team)
     for key in data:
         metrics[key] = data[key]
     metrics.save()