コード例 #1
0
    def get_issues_for_day(self, the_day=get_current_day_string()):
        root_append_default_scrum = self.schedule.get('autoScrum', True)
        that_day_schedules = next(
            iter([
                day for day in self.schedule['days'] if day['date'] == the_day
            ]), None)
        issues = []
        if that_day_schedules is not None:
            issues += [
                WorklogPost(
                    issue['key'],
                    Scheduler.parse_duration_string_to_seconds(
                        issue['timeSpent']), the_day, default_start_time,
                    issue['description'], default_author_account_id)
                for issue in that_day_schedules['issues']
            ]

        forced_single_day_report_scrum = that_day_schedules is not None and 'appendDefaultScrum' in that_day_schedules
        if forced_single_day_report_scrum:
            if that_day_schedules.get('appendDefaultScrum', False):
                issues.append(WorklogPost.create_with_defaults(the_day))
        elif root_append_default_scrum and self.post_daily_if_nothing_scheduled and is_day_workday(
                str_to_date(the_day)):
            issues.append(WorklogPost.create_with_defaults(the_day))
        return issues
コード例 #2
0
 def test_week_until_2020_03_25(self):
     with unittest.mock.patch.object(
             worklog_manager, 'post_issues',
             wraps=worklog_manager.post_issues) as monkey:
         worklog_manager.fill_missing_scrum_for_week_until_day(
             datetime(2020, 3, 25))
         monkey.assert_called_once_with([
             WorklogPost.create_with_defaults('2020-03-23'),
             WorklogPost.create_with_defaults('2020-03-25')
         ])
コード例 #3
0
 def test_2020_03_28_scheduled_saturday_should_append_daily(self):
     the_day = "2020-03-28"
     issues = scheduler.get_issues_for_day(the_day)
     self.assertEqual([create_cd_72(the_day),
                       WorklogPost.create_with_defaults(the_day)],
                      issues)
コード例 #4
0
 def test_2020_03_27_empty_workday_should_append_daily(self):
     the_day = "2020-03-27"
     issues = scheduler.get_issues_for_day(the_day)
     self.assertEqual([WorklogPost.create_with_defaults(the_day)],
                      issues)
コード例 #5
0
 def test_2020_03_26_default_daily_without_flag_in_json(self):
     the_day = "2020-03-26"
     issues = scheduler.get_issues_for_day(the_day)
     self.assertEqual([create_cd_72(the_day),
                       WorklogPost.create_with_defaults(the_day)],
                      issues)
コード例 #6
0
 def test_2020_03_25_no_default_daily_but_already_present(self):
     the_day = "2020-03-25"
     issues = scheduler.get_issues_for_day(the_day)
     self.assertEqual([WorklogPost.create_with_defaults(the_day),
                       create_cd_72(the_day)],
                      issues)
コード例 #7
0
def create_cd_72(day):
    return WorklogPost('CD-72', 27000, day, '00:00:00', 'DEV-14998 Investigate handling request for customer type', '5e5cbdc996f7d50ca054fc2a')
コード例 #8
0
 def create_worklog_for_day(anchor_time=get_current_day()):
     issue = WorklogPost.create_with_defaults(anchor_time)
     return issue