def test_load_series_really_displays_remaining_time(self):
     # in all the other tests we don't have any remaining time changes so
     # check here that it really uses  the historic remaining times and not 
     # just the lastest one.
     day_before_yesterday = yesterday(tz=utc) - timedelta(days=1)
     self.set_remaining_time(self.task1, day_before_yesterday, 3)
     self.set_remaining_time(self.task2, yesterday(tz=utc), 2)
     
     developers = self._get_resource_load_for_developers()
     dev = self.find_developer(developers, 'tester')
     self.assert_equals(3+2, self.get_remaining_time_for(yesterday(tz=utc), dev.load))
    def test_load_series_really_displays_remaining_time(self):
        # in all the other tests we don't have any remaining time changes so
        # check here that it really uses  the historic remaining times and not
        # just the lastest one.
        day_before_yesterday = yesterday(tz=utc) - timedelta(days=1)
        self.set_remaining_time(self.task1, day_before_yesterday, 3)
        self.set_remaining_time(self.task2, yesterday(tz=utc), 2)

        developers = self._get_resource_load_for_developers()
        dev = self.find_developer(developers, 'tester')
        self.assert_equals(
            3 + 2, self.get_remaining_time_for(yesterday(tz=utc), dev.load))
    def test_remaining_time_correct_even_for_closed_stories(self):
        self.sprint.start = datetime.today() - timedelta(days=5)
        self.sprint.save()

        # Store some remaining time for yesterday
        yesterday_midnight = datetime.combine(yesterday(tz=utc),
                                              time(tzinfo=utc))
        RemainingTime(self.env,
                      self.task1).set_remaining_time(3, yesterday_midnight)
        RemainingTime(self.env,
                      self.task2).set_remaining_time(1, yesterday_midnight)

        self._close_ticket_as_fixed(self.task1)
        self._close_ticket_as_fixed(self.task2)
        self._close_ticket_as_fixed(self.story1)

        remaining_times = self.get_remaining_times(self.sprint.name,
                                                   cut_to_today=True)
        # We have to use relative positioning from the end because we don't know
        # if the sprint will be extended due to a holiday.
        self.assert_equals([4, 0], remaining_times[-2:])

        # Check that the same holds true for retrieving a single day
        remaining_time = self.get_total_remaining_time(self.sprint.name,
                                                       yesterday_midnight)
        self.assert_equals(4, remaining_time)
 def testCanNotOverwriteExistingSprintByRename(self):
     self.assert_not_equals(tomorrow(utc), self.sprint.start)
     existing_name = 'existing'
     self.teh.create_sprint(existing_name, start=date_to_datetime(tomorrow(utc)))
     
     one_day_before = date_to_datetime(yesterday(), tz=utc)
     
     parameters = dict(old_sprint=self.sprint.name, sprint=existing_name, start=one_day_before)
     self.assert_raises(ICommand.NotValidError, self._save_sprint, **parameters)
Beispiel #5
0
 def test_return_capacity_information_until_end_of_sprint_even_if_last_values_are_zero(self):
     self.teh.disable_sprint_date_normalization()
     team, member = self.team_with_one_member()
     self._set_default_capacity_for_member(0, member)
     sprint = self.teh.create_sprint('Foo Sprint')
     sprint.start = midnight(yesterday())
     sprint.end = midnight(day_after_tomorrow())
     
     capacities = team.capacity().hourly_capacities_in_sprint(sprint)
     # +1 because the last item is from 22:00-23:00
     self.assert_length(24*3+1, capacities)
    def testCanNotOverwriteExistingSprintByRename(self):
        self.assert_not_equals(tomorrow(utc), self.sprint.start)
        existing_name = 'existing'
        self.teh.create_sprint(existing_name,
                               start=date_to_datetime(tomorrow(utc)))

        one_day_before = date_to_datetime(yesterday(), tz=utc)

        parameters = dict(old_sprint=self.sprint.name,
                          sprint=existing_name,
                          start=one_day_before)
        self.assert_raises(ICommand.NotValidError, self._save_sprint,
                           **parameters)
Beispiel #7
0
 def test_can_sum_remaining_capacities_in_sprint(self):
     self.teh.disable_sprint_date_normalization()
     team, member = self.team_with_one_member()
     self._set_default_capacity_for_member(9*2, member)
     
     sprint =  self.teh.create_sprint(name="SprintWithContingent", team=team,
                                      start=midnight(yesterday()), 
                                      end=midnight(tomorrow()))
     summed = team.capacity().summed_hourly_capacities_in_sprint(sprint)
     # 2*9 (no. working hours), +8 (additional hours after zero), +1 (00:00-01:00 on the last day)
     self.assert_length(9*2+8+1, summed)
     self.assert_equals(2*(9*2), summed[0].capacity)
     self.assert_equals(0, summed[-1].capacity)
Beispiel #8
0
 def test_can_cut_off_times_that_would_be_on_next_day(self):
     team, member1, member2 = self.team_with_two_members()
     set_user_attribute_in_session(self.env, 'tz', 'GMT', member1.name)
     set_user_attribute_in_session(self.env, 'tz', 'GMT -8:00', member2.name)
     viewer_timezone = member1.timezone()
     self.set_hours_for_day_on_team_member(0, yesterday(viewer_timezone), member2)
     # 15:00 at his place is 23:00 here, so two values should be lost
     
     day = today(tz=member1.timezone())
     capacities = team.capacity(viewer_timezone).hourly_capacities_for_day(day)
     self.assert_length(16, capacities)
     self.assert_equals(1, capacities[0].capacity)
     self.assert_equals(1, capacities[-2].capacity)
     last_hour_of_member1 = datetime.combine(day, time(23, tzinfo=member1.timezone()))
     self.assert_equals(last_hour_of_member1, capacities[-2].when)
Beispiel #9
0
 def testStoreRemainingTimeAsTimestamp(self):
     task = self.teh.create_ticket(Type.TASK)
     task[Key.REMAINING_TIME] = '5'
     task.save_changes(None, None)
     
     an_hour_before = now() - timedelta(hours=1)
     half_an_hour_before = now() - timedelta(minutes=30)
     
     remaining = RemainingTime(self.env, task)
     remaining.set_remaining_time(3, day=an_hour_before)
     
     self.assert_equals(5, remaining.get_remaining_time())
     self.assert_equals(5, remaining.get_remaining_time(now()))
     self.assert_equals(3, remaining.get_remaining_time(half_an_hour_before))
     self.assert_equals(3, remaining.get_remaining_time(an_hour_before))
     self.assert_equals(0, remaining.get_remaining_time(yesterday()))
Beispiel #10
0
    def testStoreRemainingTimeAsTimestamp(self):
        task = self.teh.create_ticket(Type.TASK)
        task[Key.REMAINING_TIME] = '5'
        task.save_changes(None, None)

        an_hour_before = now() - timedelta(hours=1)
        half_an_hour_before = now() - timedelta(minutes=30)

        remaining = RemainingTime(self.env, task)
        remaining.set_remaining_time(3, day=an_hour_before)

        self.assert_equals(5, remaining.get_remaining_time())
        self.assert_equals(5, remaining.get_remaining_time(now()))
        self.assert_equals(3,
                           remaining.get_remaining_time(half_an_hour_before))
        self.assert_equals(3, remaining.get_remaining_time(an_hour_before))
        self.assert_equals(0, remaining.get_remaining_time(yesterday()))
 def test_remaining_time_correct_even_for_closed_stories(self):
     self.sprint.start = datetime.today() - timedelta(days=5)
     self.sprint.save()
     
     # Store some remaining time for yesterday
     yesterday_midnight = datetime.combine(yesterday(tz=utc), time(tzinfo=utc))
     RemainingTime(self.env, self.task1).set_remaining_time(3, yesterday_midnight)
     RemainingTime(self.env, self.task2).set_remaining_time(1, yesterday_midnight)
     
     self._close_ticket_as_fixed(self.task1)
     self._close_ticket_as_fixed(self.task2)
     self._close_ticket_as_fixed(self.story1)
     
     remaining_times = self.get_remaining_times(self.sprint.name, cut_to_today=True)
     # We have to use relative positioning from the end because we don't know
     # if the sprint will be extended due to a holiday.
     self.assert_equals([4, 0], remaining_times[-2:])
     
     # Check that the same holds true for retrieving a single day
     remaining_time = self.get_total_remaining_time(self.sprint.name, yesterday_midnight)
     self.assert_equals(4, remaining_time)
 def yesterday_midnight(self):
     return midnight(yesterday(tz=utc), tz=utc)
Beispiel #13
0
 def yesterday_midnight(self):
     return midnight(yesterday(tz=utc), tz=utc)
Beispiel #14
0
 def test_can_return_capacity_series_for_interval(self):
     team, member1 = self.team_with_one_member()
     self._set_default_capacity_for_member(1, member1)
     # tomorrow -> date -> 0:00 on date -> removes everything on that day
     self.assert_length(2*9 + 2, team.capacity().hourly_capacities_in_interval(yesterday(), tomorrow()))