新增代码库模块相关测试用例

This commit is contained in:
floraachy
2023-12-14 17:07:36 +08:00
parent f30dbb0181
commit ead008c96b
29 changed files with 1077 additions and 16 deletions

View File

@@ -0,0 +1,54 @@
case_common:
allure_epic: GitLink接口
allure_feature: 开源项目模块
allure_story: 合并请求
case_markers:
- gitlink
- pr
- gitea
- usefixtures: get_oauth_token
- skip: 前提是有一个开启状态的PR暂时略过
case_info:
-
id: gitlink_repo_edit_pull_request_001
title: 编辑一个合并请求
severity:
run: True
url: /api/v1/${project_url}/edit/${pr_id}.json
method: PUT
headers:
Content-Type: application/json; charset=utf-8;
Authorization: ${token_type} ${access_token}
cookies:
request_type: json
payload:
title: ${generate_words()} # 合并请求标题
body: ${generate_paragraph()} # 合并请求内容
head: # 源分支
base: master # 目标分支
is_original: false # 是否为fork仓库发来的合并请求
fork_project_id: # fork仓库ID
merge_project_identifier:
files_count: 1
commits_count: 1
receivers_login: [] # @人员的login
issue_tag_ids: master # 标记ID数组
assigned_to_id: # 指派人员ID
fixed_version_id: # 里程碑ID
priority_id: # 优先级ID
files:
assert_response:
status_code: 200
assertStatus:
message: 断言接口返回status=0
expect_value: 0
assert_type: ==
type_jsonpath: $.status
assertMessage:
message: 断言接口返回message
expect_value: PullRequest更新成功
assert_type: ==
type_jsonpath: $.message
assert_sql:
extract:

View File

@@ -0,0 +1,54 @@
case_common:
allure_epic: GitLink接口
allure_feature: 开源项目模块
allure_story: 合并请求
case_markers:
- gitlink
- pr
- gitea
- usefixtures: get_oauth_token
- skip: 前提是仓库存在2个不同的分支暂时略过
case_info:
-
id: gitlink_repo_new_pull_request_001
title: 创建一个合并请求
severity:
run: True
url: /api/v1/${project_url}/pulls.json
method: POST
headers:
Content-Type: application/json; charset=utf-8;
Authorization: ${token_type} ${access_token}
cookies:
request_type: json
payload:
title: ${generate_words()} # 合并请求标题
body: ${generate_paragraph()} # 合并请求内容
head: # 源分支
base: master # 目标分支
is_original: false # 是否为fork仓库发来的合并请求
fork_project_id: # fork仓库ID
merge_project_identifier:
files_count: 1
commits_count: 1
receivers_login: [] # @人员的login
issue_tag_ids: master # 标记ID数组
assigned_to_id: # 指派人员ID
fixed_version_id: # 里程碑ID
priority_id: # 优先级ID
files:
assert_response:
status_code: 200
assertStatus:
message: 断言接口返回status=0
expect_value: 0
assert_type: ==
type_jsonpath: $.status
assertMessage:
message: 断言接口返回message
expect_value: 响应成功
assert_type: ==
type_jsonpath: $.message
assert_sql:
extract:

View File

@@ -0,0 +1,45 @@
case_common:
allure_epic: GitLink接口
allure_feature: 开源项目模块
allure_story: 合并请求
case_markers:
- gitlink
- pr
- gitea
- usefixtures: get_oauth_token
- skip: 前提是有一个开启状态的PR暂时略过
case_info:
-
id: gitlink_repo_pr_merge_001
title: 合并一个合并请求
severity:
run: True
url: /api/v1/${project_url}/edit/${pr_id}/pr_merge.json
method: POST
headers:
Content-Type: application/json; charset=utf-8;
Authorization: ${token_type} ${access_token}
cookies:
request_type: json
payload:
project_id: ${repo_identifier} # 项目标识
id: ${pr_id} # 合并请求id
do: merge
title: ${generate_words()}
body: ${generate_words()}
files:
assert_response:
status_code: 200
assertStatus:
message: 断言接口返回status=0
expect_value: 0
assert_type: ==
type_jsonpath: $.status
assertMessage:
message: 断言接口返回message
expect_value: 合并成功
assert_type: ==
type_jsonpath: $.message
assert_sql:
extract:

View File

@@ -0,0 +1,42 @@
case_common:
allure_epic: GitLink接口
allure_feature: 开源项目模块
allure_story: 合并请求
case_markers:
- gitlink
- pr
- gitea
- usefixtures: get_oauth_token
case_info:
-
id: gitlink_repo__pull_request_001
title: 获取合并请求列表
severity:
run: True
url: /api/v1/${project_url}/pulls.json
method: GET
headers:
Content-Type: application/json; charset=utf-8;
Authorization: ${token_type} ${access_token}
cookies:
request_type: params
payload:
assign_user_id: # 指派人员ID
issue_tag_id: # 标记ID
keyword: # 搜索关键词
priority_id: # 优先级ID
reviewer_id: # 审查人员ID
sort_by: # 排序字段updated_at 更新时间 created_at 创建时间
sort_direction: # 排序类型。desc 倒序 asc 正序
status: # 合并请求类型0 开启的 1 合并的 2 关闭,不传为全部
version_id: # 里程碑ID
files:
assert_response:
status_code: 200
assertField:
message: 断言接口存在字段total_count
expect_value: total_count
assert_type: contains
assert_sql:
extract:

View File

@@ -0,0 +1,40 @@
case_common:
allure_epic: GitLink接口
allure_feature: 开源项目模块
allure_story: 合并请求
case_markers:
- gitlink
- pr
- gitea
- usefixtures: get_oauth_token
- skip: 前提是有一个开启状态的PR暂时略过
case_info:
-
id: gitlink_repo_refuse_merge_001
title: 拒绝一个合并请求
severity:
run: True
url: /api/v1/${project_url}/edit/${pr_id}/refuse_merge.json
method: POST
headers:
Content-Type: application/json; charset=utf-8;
Authorization: ${token_type} ${access_token}
cookies:
request_type: json
payload:
files:
assert_response:
status_code: 200
assertStatus:
message: 断言接口返回status=0
expect_value: 0
assert_type: ==
type_jsonpath: $.status
assertMessage:
message: 断言接口返回message
expect_value: 已拒绝
assert_type: ==
type_jsonpath: $.message
assert_sql:
extract: