コード例 #1
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 def test_can_return_empty_list_if_no_capacity_is_there(self):
     team, member1, member2 = self.team_with_two_members()
     self.set_hours_for_day_on_team_member(0, today(), member1)
     self.set_hours_for_day_on_team_member(0, today(), member2)
     
     capacities = team.capacity(member1.timezone()).hourly_capacities_for_day(today())
     self.assert_length(0, capacities)
コード例 #2
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 def testCalendarForTeamMemberInterval(self):
     """Tests the calendar returned for a given interval of time"""
     self.tmc.set_hours_for_day(5, today())
     cal = self.tmc.get_hours_for_interval(today() - (3 * one_day),
                                           today() + (3 * one_day))
     self.assert_equals(cal[today()], 5)
     self.assert_equals(len(cal), 7)
コード例 #3
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 def test_can_return_correct_capacities_per_hour(self):
     capacity = 6
     self.tmc.set_hours_for_day(capacity, today())
     capacities = self.tmc.hourly_capacities_for_day(today())
     
     work_hours = self.tm.number_of_working_hours_on_workday()
     capacity_per_hour = capacity / float(work_hours)
     for capacity in capacities:
         self.assert_almost_equals(capacity_per_hour, capacity.capacity, max_delta=0.01)
コード例 #4
0
ファイル: backlog_info_test.py プロジェクト: djangsters/agilo
 def test_gets_read_only_backlog_for_ended_sprint(self):
     # ensure it ends before the weekend so the test doesn't fail on mondays...
     sprint_start = date_to_datetime(today() - timedelta(days=4))
     sprint_end = sprint_start + timedelta(days=1)
     sprint = self.teh.create_sprint(name='fnord', start=sprint_start, end=sprint_end)
     self.assert_smaller_than(sprint.end, date_to_datetime(today()))
     backlog = self.teh.create_backlog(scope=sprint.name, b_type=BacklogType.SPRINT)
     backlog_access = self.access_rights_for_backlog(backlog)
     self.assert_true(backlog_access['is_read_only'])
     self.assert_equals('Cannot modify sprints that have ended.', backlog_access['reason'])
コード例 #5
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 def test_capacity_can_take_timezone_parameter(self):
     team, member = self.team_with_one_member()
     self._set_default_capacity_for_member(0, member)
     set_user_attribute_in_session(self.env, 'tz', 'GMT', member.name)
     self.set_hours_for_day_on_team_member(9, today(member.timezone()), member)
     
     viewer_timezone = get_timezone('GMT -12:00')
     capacitator = team.capacity(viewer_timezone)
     # Need to take the member timezone for start and end, to make sure that we really cut off all
     # workhours he has on the previous day - even though they would be on the current day when
     # viewed from the viewers timezone.
     hourly_capacities = capacitator.hourly_capacities_in_interval(today(tz=member.timezone()), tomorrow(tz=member.timezone()))
     self.assert_length(7, hourly_capacities)
コード例 #6
0
ファイル: backlog_info_test.py プロジェクト: nagyist/agilo
 def test_gets_read_only_backlog_for_ended_sprint(self):
     # ensure it ends before the weekend so the test doesn't fail on mondays...
     sprint_start = date_to_datetime(today() - timedelta(days=4))
     sprint_end = sprint_start + timedelta(days=1)
     sprint = self.teh.create_sprint(name='fnord',
                                     start=sprint_start,
                                     end=sprint_end)
     self.assert_smaller_than(sprint.end, date_to_datetime(today()))
     backlog = self.teh.create_backlog(scope=sprint.name,
                                       b_type=BacklogType.SPRINT)
     backlog_access = self.access_rights_for_backlog(backlog)
     self.assert_true(backlog_access['is_read_only'])
     self.assert_equals('Cannot modify sprints that have ended.',
                        backlog_access['reason'])
コード例 #7
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 def test_can_return_hourly_capacity_on_specific_day(self):
     team, member1, member2 = self.team_with_two_members()
     
     capacities = team.capacity(member1.timezone()).hourly_capacities_for_day(today())
     self.assert_length(10, capacities)
     for capacity in capacities[:-1]:
         self.assert_equals(2, capacity.capacity)
コード例 #8
0
ファイル: burndown.py プロジェクト: nagyist/agilo
 def get_remaining_time(self, day=None):
     """Returns the remaining time on a specific day, passed as a date or
     ordinal value. If none, returns remaining time for today"""
     if day is None:
         # if is today, just return the current remaining time
         return float(self.task[Key.REMAINING_TIME] or 0)
     timestamp = self._get_timestamp(day)
     
     available_timestamps = sorted(self.history)
     remaining_time = None
     if len(available_timestamps) > 0:
         if timestamp < available_timestamps[0]:
             return 0.0
         elif timestamp >= available_timestamps[-1]:
             return self.history[available_timestamps[-1]]
         else:
             last_timestamp = available_timestamps[0]
             for a_timestamp in available_timestamps:
                 if a_timestamp > timestamp:
                     # the last one was the good one
                     remaining_time = self.history[last_timestamp]
                     break
                 last_timestamp = a_timestamp
     else:
         # In case timestamp was built from an ordinal, we must use 0:00 to 
         # check instead of the current time
         if timestamp >= to_timestamp(midnight(today(), tz=localtz)):
             remaining_time = float(self.task[Key.REMAINING_TIME] or 0)
         else:
             remaining_time = 0.0
     return remaining_time
コード例 #9
0
ファイル: new_webui_test.py プロジェクト: djangsters/agilo
 def test_can_return_backlog_info(self):
     sprint_start = date_to_datetime(today() - timedelta(days=4))
     sprint_end = sprint_start + timedelta(days=1)
     sprint = self.teh.create_sprint(name='fnord', start=sprint_start, end=sprint_end)
     backlog = self.teh.create_backlog(scope=sprint.name, b_type=BacklogType.SPRINT)
     info = self.request_backlog(backlog).backlog_info
     self.assert_not_none(info.content['configured_columns'])
コード例 #10
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 def test_can_combine_different_timezones(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 +1:00', member2.name)
     
     capacities = team.capacity(member1.timezone()).hourly_capacities_for_day(today())
     self.assert_length(11, capacities)
     self.assert_equals(1, capacities[0].capacity)
     self.assert_equals(1, capacities[-2].capacity)
コード例 #11
0
ファイル: backlog_info_test.py プロジェクト: nagyist/agilo
 def test_not_read_only_if_sprint_not_started(self):
     self.teh.grant_permission(Usernames.team_member, Action.BACKLOG_EDIT)
     sprint = self.teh.create_sprint(name='fnord',
                                     start=date_to_datetime(today() +
                                                            timedelta(3)))
     backlog = self.teh.create_backlog(scope=sprint.name,
                                       b_type=BacklogType.SPRINT)
     backlog_access = self.access_rights_for_backlog(backlog)
     self.assert_false(backlog_access['is_read_only'],
                       backlog_access['reason'])
コード例 #12
0
 def test_can_return_backlog_info(self):
     sprint_start = date_to_datetime(today() - timedelta(days=4))
     sprint_end = sprint_start + timedelta(days=1)
     sprint = self.teh.create_sprint(name='fnord',
                                     start=sprint_start,
                                     end=sprint_end)
     backlog = self.teh.create_backlog(scope=sprint.name,
                                       b_type=BacklogType.SPRINT)
     info = self.request_backlog(backlog).backlog_info
     self.assert_not_none(info.content['configured_columns'])
コード例 #13
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 def test_includes_times_from_previous_day_that_get_shifted_to_today_through_the_timezone_difference(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 -7:00', member2.name)
     
     day = today(tz=member1.timezone())
     yesterday = day - timedelta(days=1)
     self.set_hours_for_day_on_team_member(9, yesterday, member2)
     # member2s last hour of yesterday should happen on today for member1
     capacities = team.capacity(member1.timezone()).hourly_capacities_for_day(day)
     member1_midnight = datetime.combine(day, time(0, tzinfo=member1.timezone()))
     self.assert_equals(member1_midnight, capacities[0].when)
     self.assert_equals(1, capacities[0].capacity)
コード例 #14
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 def test_includes_times_from_next_day_that_get_shifted_to_today_through_the_timezone_difference(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 +10:00', member2.name)
     
     day = today(tz=member1.timezone())
     tomorrow = day + timedelta(days=1)
     self.set_hours_for_day_on_team_member(9, tomorrow, member2)
     # member2s first hour of tomorrow should happen on today for member1
     capacities = team.capacity(member1.timezone()).hourly_capacities_for_day(day)
     member1_last_hour = datetime.combine(day, time(23, tzinfo=member1.timezone()))
     self.assert_equals(member1_last_hour, capacities[-2].when)
     self.assert_equals(1, capacities[-2].capacity)
コード例 #15
0
 def setUp(self):
     self.super()
     self.tester.login_as(Usernames.admin)
     
     # I had problems on mondays that the sprint start would sometimes be shifted
     # to the next day - definitely a bug, but not one I will solve now
     two_weeks_ago = today() - timedelta(14)
     team_name = self.tester.create_team_with_two_members()
     milestone_name = self.tester.create_milestone('MilestoneFor' + self.sprint_name())
     self.tester.create_sprint_for_milestone(milestone_name, self.sprint_name(), 
         team=team_name, start=two_weeks_ago, duration=30)
     
     story_id, task_ids = self.tester.create_userstory_with_tasks(self.sprint_name())
     second_story_id, more_task_ids = self.tester.create_userstory_with_tasks(self.sprint_name())
     self.original_order = [story_id] + task_ids + [second_story_id] + more_task_ids
コード例 #16
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 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)
コード例 #17
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 def test_cuts_off_times_that_would_be_on_previous_day_for_the_viewer(self):
     team, member1 = self.team_with_one_member()
     set_user_attribute_in_session(self.env, 'tz', 'GMT +11:00', member1.name)
     
     viewer_timezone = utc
     # don't want to get values from tomorrow
     self.set_hours_for_day_on_team_member(0, tomorrow(viewer_timezone), member1)
     # 11:00 at his place is 0:00 here, so two values should be lost
     
     capacities = team.capacity(viewer_timezone).hourly_capacities_for_day(today())
     self.assert_length(8, capacities)
     self.assert_equals(1, capacities[0].capacity)
     self.assert_equals(1, capacities[-2].capacity)
     start_of_day_for_member1 = midnight(now(tz=viewer_timezone))
     self.assert_equals(start_of_day_for_member1, capacities[0].when)
コード例 #18
0
    def setUp(self):
        self.super()
        self.tester.login_as(Usernames.admin)

        # I had problems on mondays that the sprint start would sometimes be shifted
        # to the next day - definitely a bug, but not one I will solve now
        two_weeks_ago = today() - timedelta(14)
        team_name = self.tester.create_team_with_two_members()
        milestone_name = self.tester.create_milestone('MilestoneFor' +
                                                      self.sprint_name())
        self.tester.create_sprint_for_milestone(milestone_name,
                                                self.sprint_name(),
                                                team=team_name,
                                                start=two_weeks_ago,
                                                duration=30)

        story_id, task_ids = self.tester.create_userstory_with_tasks(
            self.sprint_name())
        second_story_id, more_task_ids = self.tester.create_userstory_with_tasks(
            self.sprint_name())
        self.original_order = [story_id] + task_ids + [second_story_id
                                                       ] + more_task_ids
コード例 #19
0
ファイル: days_time_test.py プロジェクト: nagyist/agilo
    def test_normalize_date_can_work_with_dates(self):
        self.assert_isinstance(today(), date)

        normalize_date(today(), shift_to_next_work_day=True)
        normalize_date(today(), shift_to_next_work_day=False)
コード例 #20
0
ファイル: days_time_test.py プロジェクト: djangsters/agilo
 def test_normalize_date_can_work_with_dates(self):
     self.assert_isinstance(today(), date)
     
     normalize_date(today(), shift_to_next_work_day=True)
     normalize_date(today(), shift_to_next_work_day=False)
コード例 #21
0
ファイル: backlog_info_test.py プロジェクト: djangsters/agilo
 def test_not_read_only_if_sprint_not_started(self):
     self.teh.grant_permission(Usernames.team_member, Action.BACKLOG_EDIT)
     sprint = self.teh.create_sprint(name='fnord', start=date_to_datetime(today() + timedelta(3)))
     backlog = self.teh.create_backlog(scope=sprint.name, b_type=BacklogType.SPRINT)
     backlog_access = self.access_rights_for_backlog(backlog)
     self.assert_false(backlog_access['is_read_only'], backlog_access['reason'])
コード例 #22
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 def test_returns_no_capacity_if_capacity_is_zero(self):
     self.tmc.set_hours_for_day(0, today()) # just something
     capacities = self.tmc.hourly_capacities_for_day(today())
     self.assert_length(0, capacities)
コード例 #23
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 def test_capacities_have_correct_timezone(self):
     self.tmc.set_hours_for_day(23, today()) # just something
     capacities = self.tmc.hourly_capacities_for_day(today())
     start_time = capacities[0].when
     self.assert_equals(self.tm.timezone(), start_time.tzinfo)
コード例 #24
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 def test_hours_will_increase_monotoneously_in_capacities(self):
     self.tmc.set_hours_for_day(23, today()) # just something
     capacities = self.tmc.hourly_capacities_for_day(today())
     start_time = capacities[0].when
     for index, capacity in enumerate(capacities):
         self.assert_equals(start_time.hour + index, capacity.when.hour)
コード例 #25
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 def test_can_return_list_of_capacities(self):
     self.tmc.set_hours_for_day(23, today()) # just to ensure there is some
     capacities = self.tmc.hourly_capacities_for_day(today())
     self.assert_length(self.tm.number_of_working_hours_on_workday(), capacities)
コード例 #26
0
ファイル: team_test.py プロジェクト: nagyist/agilo
 def test_last_entry_of_hourly_capacity_is_zero(self):
     team, member1, member2 = self.team_with_two_members()
     
     capacities = team.capacity(member1.timezone()).hourly_capacities_for_day(today())
     self.assert_equals(0, capacities[-1].capacity)