コード例 #1
0
    def test_assign_open_merge_requests_not_stale(
        self,
        mock_open_merge_requests,
        mock_get_project_members,
        mock_assign_user_to_merge,
    ):
        cli_args = {"ip_address": "localhost", "interval": 1, "token": "test"}

        # Set the created_at date to be less than 24 hours old
        created_at = pytz.utc.localize(datetime.utcnow())

        mock_open_merge_requests.return_value = [{
            "work_in_progress":
            False,
            "created_at":
            created_at.isoformat(),
            "assignee":
            None,
            "project_id":
            1,
            "author": {
                "id": 1
            },
            "iid":
            1,
        }]

        assign_open_merge_requests(cli_args)

        self.assertEqual(mock_get_project_members.called, False)
        self.assertEqual(mock_get_project_members.call_count, 0)
        self.assertEqual(mock_assign_user_to_merge.called, False)
        self.assertEqual(mock_assign_user_to_merge.call_count, 0)
コード例 #2
0
ファイル: main.py プロジェクト: stuartmccoll/gitlab-attendant
def tasks(args):
    """
    Function calls to the tasks that the GitLab Attendant
    is capable of running.
    """
    logger.info("GitLab Attendant has woken up...")
    logger.info(
        f"GitLab Attendant will begin attending to GitLab instance at {args['ip_address']}..."
    )

    assign_project_members_to_issues(args)
    assign_open_merge_requests(args)
    notify_issue_assignees(args, 7)
    notify_stale_merge_request_assignees(args, 7)
    remove_merged_branches(args)
コード例 #3
0
    def test_assign_open_merge_requests_work_in_progress(
        self,
        mock_open_merge_requests,
        mock_get_project_members,
        mock_assign_user_to_merge,
    ):
        cli_args = {"ip_address": "localhost", "interval": 1, "token": "test"}

        mock_open_merge_requests.return_value = [{"work_in_progress": True}]

        assign_open_merge_requests(cli_args)

        self.assertEqual(mock_get_project_members.called, False)
        self.assertEqual(mock_get_project_members.call_count, 0)
        self.assertEqual(mock_assign_user_to_merge.called, False)
        self.assertEqual(mock_assign_user_to_merge.call_count, 0)