diff --git a/release-assistant/javcra/api/gitee_api.py b/release-assistant/javcra/api/gitee_api.py index 67a7278499a100f5df4576563d310b78934c30aa..fedc8db375e21d59bfecf30c0311d07c20956432 100644 --- a/release-assistant/javcra/api/gitee_api.py +++ b/release-assistant/javcra/api/gitee_api.py @@ -586,6 +586,26 @@ class Issue: return True + def get_comment_issues(self, issue_params): + """ + get issues in comment + + Args: + issue_params: params for issue + + Returns: + issues(list) + """ + issue_comments = self.get_issue_comments(issue_params) + issues = [] + if not issue_comments: + return issues + + issues = re.findall("(?<=[#/])[A-Z0-9]{6}", str(issue_comments)) + result = list(set(issues)) + result.sort(key=issues.index) + return result + def create_issue_label(self, label_list, params): """ create label for release issue diff --git a/release-assistant/javcra/application/modifypart/modifyentrance.py b/release-assistant/javcra/application/modifypart/modifyentrance.py index a5acb3aa947a69f303390cf946dcb1426ddd4eea..ff4c3e3c2b2c5da99e4addad862b9e722cfae79e 100644 --- a/release-assistant/javcra/application/modifypart/modifyentrance.py +++ b/release-assistant/javcra/application/modifypart/modifyentrance.py @@ -511,14 +511,14 @@ class Operation(Issue): "not allowed 'operate' value,expected in ['init','add','delete','update'],but given {}".format(operate) ) - def init(self, *args): + def init(self, *args, issues=None): """ init specific block Returns: init str """ - return self.get_new_issue_body(operate="init", *args) + return self.get_new_issue_body(operate="init", *args, issues=issues) def get_new_issue_body(self, *args, operate="init", body_str=None, issues=None): raise NotImplementedError @@ -642,7 +642,13 @@ class BugFixIssue(Operation): table_head = ["issue", "仓库", "status"] block_name = "## 2、bugfix" + bugfix_list = [] + for issue_id in issues: + # latest issue status + single_issue_info = self.get_single_issue_info(issue_id, block_name) + bugfix_list.append(single_issue_info[0]) + bugfix_prefix = "修复bugfix {}个".format(len(bugfix_list)) return self.operate_for_specific_block( @@ -1091,7 +1097,7 @@ class IssueOperation(Operation): return False return True - def init_issue_description(self, *args): + def init_issue_description(self, *args, issues): """ initialize the release issue body when commenting "start-update" command @@ -1104,7 +1110,7 @@ class IssueOperation(Operation): release_range = "# 1、发布范围\n" cve_block_str = self.cve_object.init(*args) - bugfix_block_str = self.bugfix_object.init() + bugfix_block_str = self.bugfix_object.init(issues=issues) requires_block_str = self.requires_object.init() repo_block_str = self.init_repo_table() install_build_block_str = self.install_build_object.init() @@ -1257,7 +1263,7 @@ class IssueOperation(Operation): """ try: if operation == "init": - return self.init_issue_description(*args) + return self.init_issue_description(*args, issues=issues) else: return self.update_issue_description( operate=operation, update_block=operate_block, issues=issues diff --git a/release-assistant/javcra/cli/commands/startpart.py b/release-assistant/javcra/cli/commands/startpart.py index 9854bb3427e5437871a19f3e467aac9a22b6fe6d..f242b5652fc76db0af8c7a84773930256c19e948 100644 --- a/release-assistant/javcra/cli/commands/startpart.py +++ b/release-assistant/javcra/cli/commands/startpart.py @@ -73,8 +73,10 @@ class StartCommand(BaseCommand): if not validate_result: return issue = IssueOperation(GITEE_REPO, params.token, params.releaseIssueID) + comment_params = {"owner": "openeuler", "repo": GITEE_REPO, "issue_id": params.releaseIssueID} + issues = issue.get_comment_issues(comment_params) args = (params.useremail, params.ak, params.sk) - start_res = issue.operate_release_issue(operation="init", *args) + start_res = issue.operate_release_issue(operation="init", *args, issues=issues) if start_res: print("[INFO] start update successfully.") else: diff --git a/release-assistant/test/test_check/test_check_cli.py b/release-assistant/test/test_check/test_check_cli.py index 22bea2307d6bb797204161ebb386acd28fc4b30c..694928e3e264b4b2d981c4e9f571edf4cfe94f42 100644 --- a/release-assistant/test/test_check/test_check_cli.py +++ b/release-assistant/test/test_check/test_check_cli.py @@ -51,7 +51,8 @@ class TestCheck(TestMixin): self.mock_requests_post(return_value=mock_post_data) self.mock_request( side_effect=[resp, resp, resp, resp, resp, mock_install_r, resp, resp, resp, mock_bugfix_r, mock_check_r, - resp, resp, mock_install_r, mock_bugfix_r, resp, resp, resp, resp, mock_repo_list_data, resp]) + mock_check_r, resp, resp, mock_install_r, mock_bugfix_r, resp, resp, resp, resp, + mock_repo_list_data, resp]) self.assert_result() def test_check_status_failed(self): diff --git a/release-assistant/test/test_modify/test_modify_cli.py b/release-assistant/test/test_modify/test_modify_cli.py index 08c8d9bdebe709b876f7a52b78bb3fad12c9bcc9..94712f7e5d4134435564a747ecc0cc9ad3f1d9ef 100644 --- a/release-assistant/test/test_modify/test_modify_cli.py +++ b/release-assistant/test/test_modify/test_modify_cli.py @@ -53,7 +53,7 @@ class TestModify(TestMixin): resp = self.make_expect_data(200, 'modifypart.txt') mock_r = self.make_need_content('add_issue_info.txt', MOCK_DATA_FILE) mock_final_r = self.make_need_content('add_bugfix_success.txt', MOCK_DATA_FILE) - self.mock_request(side_effect=[resp, resp,resp, mock_r, mock_final_r, mock_final_r]) + self.mock_request(side_effect=[resp, resp, resp, resp, mock_r, mock_final_r, mock_final_r]) self.command_params = ["I40769", "--giteeid=Mary", "--add=bugfix", "--token=example", "--id=I3AQ2G"] self.assert_result() @@ -158,7 +158,7 @@ failed to update remain issues, please check whether the issue exist in cve and """ resp = self.make_expect_data(200, 'modifypart.txt') mock_r = self.make_need_content('delete_bugfix_success.txt', MOCK_DATA_FILE) - self.mock_request(side_effect=[resp, resp, resp,resp, mock_r]) + self.mock_request(side_effect=[resp, resp, resp, resp, resp, mock_r]) self.command_params = ["I40769", "--giteeid=Mary", "--delete=bugfix", "--token=example", "--id=I3J655"] self.assert_result() @@ -201,7 +201,7 @@ update remain issues successfully. [ERROR] failed to delete I3J655 in bugfix. """ resp = self.make_expect_data(200, 'modifypart.txt') - self.mock_request(side_effect=[resp, resp, resp,resp, RequestException]) + self.mock_request(side_effect=[resp, resp, resp, resp, resp, RequestException]) self.command_params = ["I40769", "--giteeid=Mary", "--delete=bugfix", "--token=example", "--id=I3J655"] self.assert_result() @@ -295,7 +295,7 @@ failed to update remain issues, please check whether the issue exist in cve and """ resp = self.make_expect_data(200, 'modifypart.txt') mock_r = self.make_need_content('delete_multiple_bugfix_success.txt', MOCK_DATA_FILE) - self.mock_request(side_effect=[resp, resp, resp,resp, mock_r]) + self.mock_request(side_effect=[resp, resp, resp, resp, resp, resp, mock_r]) self.command_params = ["I40769", "--giteeid=Mary", "--delete=bugfix", "--token=example", "--id", "I3J655", "I3AHLY"] self.assert_result() diff --git a/release-assistant/test/test_start/mock_data/mock_issue_comment.txt b/release-assistant/test/test_start/mock_data/mock_issue_comment.txt new file mode 100644 index 0000000000000000000000000000000000000000..47d80a5b299e28bc9ac1d15ce6bbb54f225efe49 --- /dev/null +++ b/release-assistant/test/test_start/mock_data/mock_issue_comment.txt @@ -0,0 +1,36 @@ +[ + { + "id": 24010076, + "body": "issue: #I8S02F", + "user": { + "id": 5674142, + "login": "rearcher", + "name": "luxuexian", + "avatar_url": "https://gitee.com/assets/no_portrait.png", + "url": "https://gitee.com/api/v5/users/rearcher", + "html_url": "https://gitee.com/rearcher", + "remark": "", + "followers_url": "https://gitee.com/api/v5/users/rearcher/followers", + "following_url": "https://gitee.com/api/v5/users/rearcher/following_url{/other_user}", + "gists_url": "https://gitee.com/api/v5/users/rearcher/gists{/gist_id}", + "starred_url": "https://gitee.com/api/v5/users/rearcher/starred{/owner}{/repo}", + "subscriptions_url": "https://gitee.com/api/v5/users/rearcher/subscriptions", + "organizations_url": "https://gitee.com/api/v5/users/rearcher/orgs", + "repos_url": "https://gitee.com/api/v5/users/rearcher/repos", + "events_url": "https://gitee.com/api/v5/users/rearcher/events{/privacy}", + "received_events_url": "https://gitee.com/api/v5/users/rearcher/received_events", + "type": "User" + }, + "source": null, + "target": { + "issue": { + "id": 14664086, + "title": "openEuler-20.03-LTS-SP1 Update 2021/11/19 release", + "number": "I8QAVQ" + }, + "pull_request": null + }, + "created_at": "2023-12-28T11:14:12+08:00", + "updated_at": "2023-12-28T11:14:34+08:00" + } +] \ No newline at end of file diff --git a/release-assistant/test/test_start/mock_data/mock_issue_info.txt b/release-assistant/test/test_start/mock_data/mock_issue_info.txt new file mode 100644 index 0000000000000000000000000000000000000000..61d83c16af4182021bb705047f7a90c378445773 --- /dev/null +++ b/release-assistant/test/test_start/mock_data/mock_issue_info.txt @@ -0,0 +1,359 @@ +{ + "assignee": null, + "body": "|#I8Q802|release-management|待办的|\n|#I8Q802|release-management|待办的|\n|#I8Q802|release-management|待办的|\n|#I8Q802|release-management|待办的|\n|#I8Q802|release-management|待办的|\n版本目标: CVE、软件包引入升级和Bugfix修复\r\n版本: openEuler-20.03-LTS-SP1\r\n例行CVE冻结: 20211120\r\n代码冻结: 20211120\r\n\r\n版本发布负责人\r\n版本经理: @rearcher\r\n开发人员: @rearcher\r\n安全委员会: @rearcher\r\n测试人员: @rearcher ", + "branch": null, + "collaborators": [ + ], + "comments": 15, + "comments_url": "https://gitee.com/api/v5/repos/rearcher/release-management/issues/I8S02F/comments", + "created_at": "2023-12-28T11:34:35+08:00", + "deadline": null, + "depth": 0, + "finished_at": null, + "html_url": "https://gitee.com/rearcher/release-management/issues/I8S02F", + "id": 14743383, + "issue_state": "待办的", + "issue_state_detail": { + "color": "#8c92a4", + "command": null, + "created_at": "2017-09-01T03:09:13+08:00", + "icon": "icon-task-state-21", + "id": 1, + "serial": 1, + "title": "待办的", + "updated_at": "2017-09-01T03:09:13+08:00" + }, + "issue_type": "任务", + "issue_type_detail": { + "color": "#0086D6", + "created_at": "2017-09-01T03:09:12+08:00", + "id": 1, + "ident": "task", + "is_system": true, + "template": null, + "title": "任务", + "updated_at": "2017-09-01T03:09:12+08:00" + }, + "labels": [ + ], + "labels_url": "https://gitee.com/api/v5/repos/rearcher/release-management/issues/I8S02F/labels", + "milestone": null, + "number": "I8S02F", + "parent_id": 0, + "parent_url": null, + "plan_started_at": null, + "priority": 0, + "program": null, + "repository": { + "assignee": [ + { + "avatar_url": "https://gitee.com/assets/no_portrait.png", + "events_url": "https://gitee.com/api/v5/users/rearcher/events{/privacy}", + "followers_url": "https://gitee.com/api/v5/users/rearcher/followers", + "following_url": "https://gitee.com/api/v5/users/rearcher/following_url{/other_user}", + "gists_url": "https://gitee.com/api/v5/users/rearcher/gists{/gist_id}", + "html_url": "https://gitee.com/rearcher", + "id": 5674142, + "login": "rearcher", + "name": "luxuexian", + "organizations_url": "https://gitee.com/api/v5/users/rearcher/orgs", + "received_events_url": "https://gitee.com/api/v5/users/rearcher/received_events", + "remark": "", + "repos_url": "https://gitee.com/api/v5/users/rearcher/repos", + "starred_url": "https://gitee.com/api/v5/users/rearcher/starred{/owner}{/repo}", + "subscriptions_url": "https://gitee.com/api/v5/users/rearcher/subscriptions", + "type": "User", + "url": "https://gitee.com/api/v5/users/rearcher" + } + ], + "assignees_number": 1, + "assigner": { + "avatar_url": "https://gitee.com/assets/no_portrait.png", + "events_url": "https://gitee.com/api/v5/users/rearcher/events{/privacy}", + "followers_url": "https://gitee.com/api/v5/users/rearcher/followers", + "following_url": "https://gitee.com/api/v5/users/rearcher/following_url{/other_user}", + "gists_url": "https://gitee.com/api/v5/users/rearcher/gists{/gist_id}", + "html_url": "https://gitee.com/rearcher", + "id": 5674142, + "login": "rearcher", + "name": "luxuexian", + "organizations_url": "https://gitee.com/api/v5/users/rearcher/orgs", + "received_events_url": "https://gitee.com/api/v5/users/rearcher/received_events", + "remark": "", + "repos_url": "https://gitee.com/api/v5/users/rearcher/repos", + "starred_url": "https://gitee.com/api/v5/users/rearcher/starred{/owner}{/repo}", + "subscriptions_url": "https://gitee.com/api/v5/users/rearcher/subscriptions", + "type": "User", + "url": "https://gitee.com/api/v5/users/rearcher" + }, + "blobs_url": "https://gitee.com/api/v5/repos/rearcher/release-management/blobs{/sha}", + "branches_url": "https://gitee.com/api/v5/repos/rearcher/release-management/branches{/branch}", + "can_comment": false, + "collaborators_url": "https://gitee.com/api/v5/repos/rearcher/release-management/collaborators{/collaborator}", + "comments_url": "https://gitee.com/api/v5/repos/rearcher/release-management/comments{/number}", + "commits_url": "https://gitee.com/api/v5/repos/rearcher/release-management/commits{/sha}", + "contributors_url": "https://gitee.com/api/v5/repos/rearcher/release-management/contributors", + "created_at": "2023-10-18T10:26:21+08:00", + "default_branch": "master", + "description": "release management including key features, release plan, development and branch plan, release scope and notes", + "enterprise": null, + "fork": true, + "forks_count": 313, + "forks_url": "https://gitee.com/api/v5/repos/rearcher/release-management/forks", + "full_name": "rearcher/release-management", + "gvp": false, + "has_issues": true, + "has_page": false, + "has_wiki": true, + "homepage": "", + "hooks_url": "https://gitee.com/api/v5/repos/rearcher/release-management/hooks", + "html_url": "https://gitee.com/rearcher/release-management.git", + "human_name": "luxuexian/release-management", + "id": 31572529, + "internal": false, + "issue_comment": false, + "issue_comment_url": "https://gitee.com/api/v5/repos/rearcher/release-management/issues/comments{/number}", + "issue_template_source": "project", + "issues_url": "https://gitee.com/api/v5/repos/rearcher/release-management/issues{/number}", + "keys_url": "https://gitee.com/api/v5/repos/rearcher/release-management/keys{/key_id}", + "labels_url": "https://gitee.com/api/v5/repos/rearcher/release-management/labels{/name}", + "language": null, + "license": null, + "members": [ + "rearcher" + ], + "milestones_url": "https://gitee.com/api/v5/repos/rearcher/release-management/milestones{/number}", + "name": "release-management", + "namespace": { + "html_url": "https://gitee.com/rearcher", + "id": 5670230, + "name": "luxuexian", + "path": "rearcher", + "type": "personal" + }, + "notifications_url": "https://gitee.com/api/v5/repos/rearcher/release-management/notifications{?since,all,participating}", + "open_issues_count": 7, + "outsourced": false, + "owner": { + "avatar_url": "https://gitee.com/assets/no_portrait.png", + "events_url": "https://gitee.com/api/v5/users/rearcher/events{/privacy}", + "followers_url": "https://gitee.com/api/v5/users/rearcher/followers", + "following_url": "https://gitee.com/api/v5/users/rearcher/following_url{/other_user}", + "gists_url": "https://gitee.com/api/v5/users/rearcher/gists{/gist_id}", + "html_url": "https://gitee.com/rearcher", + "id": 5674142, + "login": "rearcher", + "name": "luxuexian", + "organizations_url": "https://gitee.com/api/v5/users/rearcher/orgs", + "received_events_url": "https://gitee.com/api/v5/users/rearcher/received_events", + "remark": "", + "repos_url": "https://gitee.com/api/v5/users/rearcher/repos", + "starred_url": "https://gitee.com/api/v5/users/rearcher/starred{/owner}{/repo}", + "subscriptions_url": "https://gitee.com/api/v5/users/rearcher/subscriptions", + "type": "User", + "url": "https://gitee.com/api/v5/users/rearcher" + }, + "paas": null, + "parent": { + "assignee": [ + ], + "assignees_number": 0, + "assigner": { + "avatar_url": "https://foruda.gitee.com/avatar/1677047222682821446/5329419_openeuler-ci-bot_1632792936.png", + "events_url": "https://gitee.com/api/v5/users/openeuler-ci-bot/events{/privacy}", + "followers_url": "https://gitee.com/api/v5/users/openeuler-ci-bot/followers", + "following_url": "https://gitee.com/api/v5/users/openeuler-ci-bot/following_url{/other_user}", + "gists_url": "https://gitee.com/api/v5/users/openeuler-ci-bot/gists{/gist_id}", + "html_url": "https://gitee.com/openeuler-ci-bot", + "id": 5329419, + "login": "openeuler-ci-bot", + "name": "openeuler-ci-bot", + "organizations_url": "https://gitee.com/api/v5/users/openeuler-ci-bot/orgs", + "received_events_url": "https://gitee.com/api/v5/users/openeuler-ci-bot/received_events", + "remark": "", + "repos_url": "https://gitee.com/api/v5/users/openeuler-ci-bot/repos", + "starred_url": "https://gitee.com/api/v5/users/openeuler-ci-bot/starred{/owner}{/repo}", + "subscriptions_url": "https://gitee.com/api/v5/users/openeuler-ci-bot/subscriptions", + "type": "User", + "url": "https://gitee.com/api/v5/users/openeuler-ci-bot" + }, + "blobs_url": "https://gitee.com/api/v5/repos/openeuler/release-management/blobs{/sha}", + "branches_url": "https://gitee.com/api/v5/repos/openeuler/release-management/branches{/branch}", + "can_comment": false, + "collaborators_url": "https://gitee.com/api/v5/repos/openeuler/release-management/collaborators{/collaborator}", + "comments_url": "https://gitee.com/api/v5/repos/openeuler/release-management/comments{/number}", + "commits_url": "https://gitee.com/api/v5/repos/openeuler/release-management/commits{/sha}", + "contributors_url": "https://gitee.com/api/v5/repos/openeuler/release-management/contributors", + "created_at": "2020-05-28T15:59:46+08:00", + "default_branch": "master", + "description": "release management including key features, release plan, development and branch plan, release scope and notes", + "enterprise": { + "html_url": "https://gitee.com/open_euler", + "id": 5292411, + "name": "openEuler", + "path": "open_euler", + "type": "enterprise" + }, + "fork": false, + "forks_count": 333, + "forks_url": "https://gitee.com/api/v5/repos/openeuler/release-management/forks", + "full_name": "openeuler/release-management", + "gvp": false, + "has_issues": true, + "has_page": false, + "has_wiki": true, + "homepage": "", + "hooks_url": "https://gitee.com/api/v5/repos/openeuler/release-management/hooks", + "html_url": "https://gitee.com/openeuler/release-management.git", + "human_name": "openEuler/release-management", + "id": 9576818, + "internal": false, + "issue_comment": false, + "issue_comment_url": "https://gitee.com/api/v5/repos/openeuler/release-management/issues/comments{/number}", + "issue_template_source": "enterprise", + "issues_url": "https://gitee.com/api/v5/repos/openeuler/release-management/issues{/number}", + "keys_url": "https://gitee.com/api/v5/repos/openeuler/release-management/keys{/key_id}", + "labels_url": "https://gitee.com/api/v5/repos/openeuler/release-management/labels{/name}", + "language": null, + "license": null, + "members": [ + "yaqiangchen", + "solarhu", + "paul-huang", + "gitee-cmd", + "openeuler-ci-bot" + ], + "milestones_url": "https://gitee.com/api/v5/repos/openeuler/release-management/milestones{/number}", + "name": "release-management", + "namespace": { + "html_url": "https://gitee.com/openeuler", + "id": 5161228, + "name": "openEuler", + "path": "openeuler", + "type": "group" + }, + "notifications_url": "https://gitee.com/api/v5/repos/openeuler/release-management/notifications{?since,all,participating}", + "open_issues_count": 218, + "outsourced": false, + "owner": { + "avatar_url": "https://foruda.gitee.com/avatar/1677052970231495492/5441867_georgecao_1586834388.png", + "events_url": "https://gitee.com/api/v5/users/georgecao/events{/privacy}", + "followers_url": "https://gitee.com/api/v5/users/georgecao/followers", + "following_url": "https://gitee.com/api/v5/users/georgecao/following_url{/other_user}", + "gists_url": "https://gitee.com/api/v5/users/georgecao/gists{/gist_id}", + "html_url": "https://gitee.com/georgecao", + "id": 5441867, + "login": "georgecao", + "name": "George.Cao", + "organizations_url": "https://gitee.com/api/v5/users/georgecao/orgs", + "received_events_url": "https://gitee.com/api/v5/users/georgecao/received_events", + "remark": "", + "repos_url": "https://gitee.com/api/v5/users/georgecao/repos", + "starred_url": "https://gitee.com/api/v5/users/georgecao/starred{/owner}{/repo}", + "subscriptions_url": "https://gitee.com/api/v5/users/georgecao/subscriptions", + "type": "User", + "url": "https://gitee.com/api/v5/users/georgecao" + }, + "paas": null, + "parent": null, + "path": "release-management", + "private": false, + "programs": [ + ], + "project_creator": "openeuler-ci-bot", + "project_labels": [ + { + "id": 32269, + "ident": "sig-release-management", + "name": "sig-release-management" + } + ], + "public": true, + "pull_requests_enabled": true, + "pulls_url": "https://gitee.com/api/v5/repos/openeuler/release-management/pulls{/number}", + "pushed_at": "2024-01-09T09:29:09+08:00", + "recommend": false, + "releases_url": "https://gitee.com/api/v5/repos/openeuler/release-management/releases{/id}", + "ssh_url": "git@gitee.com:openeuler/release-management.git", + "stargazers_count": 57, + "stargazers_url": "https://gitee.com/api/v5/repos/openeuler/release-management/stargazers", + "status": "开始", + "tags_url": "https://gitee.com/api/v5/repos/openeuler/release-management/tags", + "testers": [ + ], + "testers_number": 0, + "updated_at": "2024-01-09T09:29:09+08:00", + "url": "https://gitee.com/api/v5/repos/openeuler/release-management", + "watchers_count": 29 + }, + "path": "release-management", + "private": false, + "programs": [ + ], + "project_creator": "rearcher", + "project_labels": [ + ], + "public": true, + "pull_requests_enabled": true, + "pulls_url": "https://gitee.com/api/v5/repos/rearcher/release-management/pulls{/number}", + "pushed_at": "2023-12-12T14:35:58+08:00", + "recommend": false, + "releases_url": "https://gitee.com/api/v5/repos/rearcher/release-management/releases{/id}", + "ssh_url": "git@gitee.com:rearcher/release-management.git", + "stargazers_count": 0, + "stargazers_url": "https://gitee.com/api/v5/repos/rearcher/release-management/stargazers", + "status": "开始", + "tags_url": "https://gitee.com/api/v5/repos/rearcher/release-management/tags", + "testers": [ + { + "avatar_url": "https://gitee.com/assets/no_portrait.png", + "events_url": "https://gitee.com/api/v5/users/rearcher/events{/privacy}", + "followers_url": "https://gitee.com/api/v5/users/rearcher/followers", + "following_url": "https://gitee.com/api/v5/users/rearcher/following_url{/other_user}", + "gists_url": "https://gitee.com/api/v5/users/rearcher/gists{/gist_id}", + "html_url": "https://gitee.com/rearcher", + "id": 5674142, + "login": "rearcher", + "name": "luxuexian", + "organizations_url": "https://gitee.com/api/v5/users/rearcher/orgs", + "received_events_url": "https://gitee.com/api/v5/users/rearcher/received_events", + "remark": "", + "repos_url": "https://gitee.com/api/v5/users/rearcher/repos", + "starred_url": "https://gitee.com/api/v5/users/rearcher/starred{/owner}{/repo}", + "subscriptions_url": "https://gitee.com/api/v5/users/rearcher/subscriptions", + "type": "User", + "url": "https://gitee.com/api/v5/users/rearcher" + } + ], + "testers_number": 1, + "updated_at": "2024-01-08T17:29:57+08:00", + "url": "https://gitee.com/api/v5/repos/rearcher/release-management", + "watchers_count": 1 + }, + "repository_url": "https://gitee.com/api/v5/repos/rearcher/release-management", + "scheduled_time": 0, + "security_hole": false, + "state": "open", + "title": "openEuler-20.03-LTS-SP1 Update 2021/11/18 release", + "updated_at": "2023-12-28T21:18:39+08:00", + "url": "https://gitee.com/api/v5/repos/rearcher/release-management/issues/I8S02F", + "user": { + "avatar_url": "https://gitee.com/assets/no_portrait.png", + "events_url": "https://gitee.com/api/v5/users/rearcher/events{/privacy}", + "followers_url": "https://gitee.com/api/v5/users/rearcher/followers", + "following_url": "https://gitee.com/api/v5/users/rearcher/following_url{/other_user}", + "gists_url": "https://gitee.com/api/v5/users/rearcher/gists{/gist_id}", + "html_url": "https://gitee.com/rearcher", + "id": 5674142, + "login": "rearcher", + "name": "luxuexian", + "organizations_url": "https://gitee.com/api/v5/users/rearcher/orgs", + "received_events_url": "https://gitee.com/api/v5/users/rearcher/received_events", + "remark": "", + "repos_url": "https://gitee.com/api/v5/users/rearcher/repos", + "starred_url": "https://gitee.com/api/v5/users/rearcher/starred{/owner}{/repo}", + "subscriptions_url": "https://gitee.com/api/v5/users/rearcher/subscriptions", + "type": "User", + "url": "https://gitee.com/api/v5/users/rearcher" + } +} \ No newline at end of file diff --git a/release-assistant/test/test_start/test_start_cli.py b/release-assistant/test/test_start/test_start_cli.py index 22e385b22d40f25d7fa85efe30493f2aecddae5f..5c3aef03cdf3051bf0617826b3a15708b57dcba4 100644 --- a/release-assistant/test/test_start/test_start_cli.py +++ b/release-assistant/test/test_start/test_start_cli.py @@ -53,7 +53,9 @@ class TestStart(TestMixin): read_excel = pd.read_excel(Path(MOCK_DATA_FILE, "mock_cve_data.xlsx"), sheet_name="cve_list") self.mock_pandas_read_excel(return_value=read_excel) mock_label = self.make_need_content('mock_update_label.txt', MOCK_DATA_FILE) - self.mock_request(side_effect=[resp, resp, resp, mock_init_r, mock_label]) + mock_issue_comment = self.make_need_content('mock_issue_comment.txt', MOCK_DATA_FILE) + mock_issue_info = self.make_need_content('mock_issue_info.txt', MOCK_DATA_FILE) + self.mock_request(side_effect=[resp, mock_issue_comment, resp, resp, mock_issue_info, mock_init_r, mock_label]) mock_get_r = self.make_object_data(200, "The number of requests is too frequent, " "please try again later, there is currently a task being processed") self.mock_requests_get(side_effect=[mock_get_r]) @@ -79,7 +81,8 @@ class TestStart(TestMixin): self.mock_obs_cloud_get_objects(return_value=mock_r) read_excel = pd.read_excel(Path(MOCK_DATA_FILE, "mock_cve_data.xlsx"), sheet_name="cve_list") self.mock_pandas_read_excel(return_value=read_excel) - self.mock_request(side_effect=[resp, resp, resp, RequestException]) + mock_issue_comment = self.make_need_content('mock_issue_comment.txt', MOCK_DATA_FILE) + self.mock_request(side_effect=[resp, mock_issue_comment, resp, resp, RequestException]) mock_get_r = self.make_object_data(200) self.mock_requests_get(side_effect=[mock_get_r]) self.assert_result() @@ -156,7 +159,8 @@ Parameter validation failed issue_body_is_none_data = self.read_file_content('mock_issue_is_none.txt', folder=MOCK_DATA_FILE, is_json=False) mock_issue_body_is_none_r = self.make_object_data(200, issue_body_is_none_data) - self.mock_request(side_effect=[resp, mock_issue_body_is_none_r]) + mock_issue_comment = self.make_need_content('mock_issue_comment.txt', MOCK_DATA_FILE) + self.mock_request(side_effect=[resp, mock_issue_comment, mock_issue_body_is_none_r]) self.assert_result() def test_already_operated(self): @@ -172,7 +176,8 @@ Parameter validation failed already_operated_data = self.read_file_content('already_operated.txt', folder=MOCK_DATA_FILE, is_json=False) mock_already_operated_r = self.make_object_data(200, already_operated_data) - self.mock_request(side_effect=[resp, mock_already_operated_r]) + mock_issue_comment = self.make_need_content('mock_issue_comment.txt', MOCK_DATA_FILE) + self.mock_request(side_effect=[resp, mock_issue_comment, mock_already_operated_r]) self.assert_result() def test_download_file_failed(self): @@ -196,7 +201,8 @@ Parameter validation failed self.mock_obs_cloud_get_objects(return_value=mock_getobjects_r) read_excel = pd.read_excel(Path(MOCK_DATA_FILE, "mock_cve_data.xlsx"), sheet_name="cve_list") self.mock_pandas_read_excel(return_value=read_excel) - self.mock_request(side_effect=[resp, resp, resp, resp, resp, resp, resp]) + mock_issue_comment = self.make_need_content('mock_issue_comment.txt', MOCK_DATA_FILE) + self.mock_request(side_effect=[resp, mock_issue_comment, resp, resp, resp, resp, resp, resp]) mock_get_r = self.make_object_data(200) self.mock_requests_get(side_effect=[mock_get_r]) self.assert_result()