更改用例通过率计算方式;添加插件pytest-repeat,支持用例重复执行;增加数据处理方法:获取图片base64格式,支持用例数据传参需求;
This commit is contained in:
44
interface/gitlink/organization/test_delete_organization.yaml
Normal file
44
interface/gitlink/organization/test_delete_organization.yaml
Normal file
@@ -0,0 +1,44 @@
|
||||
case_common:
|
||||
allure_epic: GitLink接口
|
||||
allure_feature: 开源项目模块
|
||||
allure_story: 组织
|
||||
case_markers:
|
||||
- gitlink
|
||||
- projects
|
||||
- gitea
|
||||
- delete_organization
|
||||
- usefixtures: get_oauth_token
|
||||
|
||||
case_info:
|
||||
-
|
||||
id: gitlink_projects_delete_organization_01
|
||||
title: 删除组织
|
||||
severity: critical
|
||||
run: True
|
||||
url: /api/organizations/${org_id}.json
|
||||
method: DELETE
|
||||
headers:
|
||||
Content-Type: application/json; charset=utf-8;
|
||||
Authorization: ${token_type} ${access_token}
|
||||
cookies:
|
||||
request_type: params
|
||||
payload:
|
||||
password: ${password} # 用户登录密码
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
assertMessage:
|
||||
message: 断言响应message=success
|
||||
assert_type: ==
|
||||
expect_value: success
|
||||
type_jsonpath: $.message
|
||||
assertStatus:
|
||||
message: 断言响应status=0
|
||||
assert_type: ==
|
||||
expect_value: 0
|
||||
type_jsonpath: $.status
|
||||
assert_sql:
|
||||
extract:
|
||||
case_dependence:
|
||||
setup:
|
||||
interface: gitlink_projects_new_organization_01
|
||||
@@ -1,4 +1,3 @@
|
||||
# 公共参数
|
||||
case_common:
|
||||
allure_epic: GitLink接口
|
||||
allure_feature: 开源项目模块
|
||||
@@ -9,9 +8,7 @@ case_common:
|
||||
- gitea
|
||||
- new_organization
|
||||
- usefixtures: get_oauth_token
|
||||
- skip: 参数:image还没处理好,暂时略过
|
||||
|
||||
# 用例数据
|
||||
case_info:
|
||||
-
|
||||
id: gitlink_projects_new_organization_01
|
||||
@@ -31,7 +28,7 @@ case_info:
|
||||
description: ${generate_paragraph()} # 组织描述
|
||||
location: ${generate_city(full=False)} # 组织地区
|
||||
repo_admin_change_team_access: true # 项目管理员可以添加或移除团队的访问权限
|
||||
image: ${} # 组织图片
|
||||
image: data:image/png;base64,${get_file_content('gitlinklogo3.jpg')} # 组织图片, base64编码方式
|
||||
visibility: common # 组织可见性,默认值common
|
||||
files:
|
||||
assert_response:
|
||||
@@ -41,4 +38,9 @@ case_info:
|
||||
assert_type: contains
|
||||
expect_value: id
|
||||
assert_sql:
|
||||
extract:
|
||||
extract:
|
||||
type_jsonpath:
|
||||
org_id: $.id
|
||||
case_dependence:
|
||||
teardown:
|
||||
interface: gitlink_projects_delete_organization_01
|
||||
6
interface/gitlink/projects/issues/__init__.py
Normal file
6
interface/gitlink/projects/issues/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Time : 2023/11/14 9:56
|
||||
# @Author : floraachy
|
||||
# @File : __init__.py
|
||||
# @Software: PyCharm
|
||||
# @Desc:
|
||||
26
interface/gitlink/projects/issues/get_issue_detail.yaml
Normal file
26
interface/gitlink/projects/issues/get_issue_detail.yaml
Normal file
@@ -0,0 +1,26 @@
|
||||
case_common:
|
||||
allure_epic: 开源项目
|
||||
allure_feature: 项目
|
||||
allure_story: 疑修(Issue)
|
||||
case_markers:
|
||||
- gitlink
|
||||
- project
|
||||
- issue
|
||||
|
||||
case_info:
|
||||
-
|
||||
id: project_get_issue_detail
|
||||
title: 项目内获取疑修详情接口
|
||||
run: True
|
||||
severity: normal
|
||||
url: /api/v1/${project_url}/issues/${issue_id}
|
||||
method: GET
|
||||
headers: {"Content-Type": "application/json; charset=utf-8;"}
|
||||
cookies: ${login_cookies}
|
||||
request_type: json
|
||||
payload:
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
assert_sql:
|
||||
extract:
|
||||
@@ -0,0 +1,26 @@
|
||||
case_common:
|
||||
allure_epic: 开源项目
|
||||
allure_feature: 项目
|
||||
allure_story: 疑修(Issue)
|
||||
case_markers:
|
||||
- gitlink
|
||||
- project
|
||||
- issue
|
||||
|
||||
case_info:
|
||||
-
|
||||
id: project_get_issue_journals_detail
|
||||
title: 项目内获取疑修列表接口
|
||||
run: True
|
||||
severity: normal
|
||||
url: /api/v1/${project_url}/issues/{issue_id}/journals?category=comment&page=${page}&limit=${limit}
|
||||
method: GET
|
||||
headers: {"Content-Type": "application/json; charset=utf-8;"}
|
||||
cookies: ${login_cookies}
|
||||
request_type: json
|
||||
payload:
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
assert_sql:
|
||||
extract:
|
||||
26
interface/gitlink/projects/issues/get_issue_list.yaml
Normal file
26
interface/gitlink/projects/issues/get_issue_list.yaml
Normal file
@@ -0,0 +1,26 @@
|
||||
case_common:
|
||||
allure_epic: 开源项目
|
||||
allure_feature: 项目
|
||||
allure_story: 疑修(Issue)
|
||||
case_markers:
|
||||
- gitlink
|
||||
- project
|
||||
- issue
|
||||
|
||||
case_info:
|
||||
-
|
||||
id: project_get_issue_list
|
||||
title: 项目内获取疑修列表接口
|
||||
run: True
|
||||
severity: normal
|
||||
url: /api/v1/${project_url}/issues?participant_category=all&category=all&limit=${limit}&page=${page}
|
||||
method: GET
|
||||
headers: {"Content-Type": "application/json; charset=utf-8;"}
|
||||
cookies: ${login_cookies}
|
||||
request_type: json
|
||||
payload:
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
assert_sql:
|
||||
extract:
|
||||
29
interface/gitlink/projects/issues/new_issue_journals.yaml
Normal file
29
interface/gitlink/projects/issues/new_issue_journals.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
case_common:
|
||||
allure_epic: 开源项目
|
||||
allure_feature: 项目
|
||||
allure_story: 疑修(Issue)
|
||||
case_markers:
|
||||
- gitlink
|
||||
- project
|
||||
- issue
|
||||
|
||||
case_info:
|
||||
-
|
||||
id: project_new_issue_journals
|
||||
title: 项目内新建疑修评论接口
|
||||
run: True
|
||||
severity: normal
|
||||
url: /api/v1/${project_url}/issues/${issue_id}/journals
|
||||
method: POST
|
||||
headers: {"Content-Type": "application/json; charset=utf-8;"}
|
||||
cookies: ${login_cookies}
|
||||
request_type: json
|
||||
payload:
|
||||
parent_id: 0
|
||||
note:
|
||||
receivers_login: [ ]
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
assert_sql:
|
||||
extract:
|
||||
@@ -0,0 +1,30 @@
|
||||
case_common:
|
||||
allure_epic: 开源项目
|
||||
allure_feature: 项目
|
||||
allure_story: 疑修(Issue)
|
||||
case_markers:
|
||||
- gitlink
|
||||
- project
|
||||
- issue
|
||||
|
||||
case_info:
|
||||
-
|
||||
id: project_new_issue_journals
|
||||
title: 项目内新建疑修评论回复接口
|
||||
run: True
|
||||
severity: normal
|
||||
url: /api/v1/${project_url}/issues/${issue_id}/journals
|
||||
method: POST
|
||||
headers: {"Content-Type": "application/json; charset=utf-8;"}
|
||||
cookies: ${login_cookies}
|
||||
request_type: json
|
||||
payload:
|
||||
parent_id:
|
||||
reply_id:
|
||||
note:
|
||||
receivers_login: []
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
assert_sql:
|
||||
extract:
|
||||
54
interface/gitlink/projects/issues/test_new_issue.yaml
Normal file
54
interface/gitlink/projects/issues/test_new_issue.yaml
Normal file
@@ -0,0 +1,54 @@
|
||||
case_common:
|
||||
allure_epic: GitLink接口
|
||||
allure_feature: 开源项目模块
|
||||
allure_story: 疑修(Issue)
|
||||
case_markers:
|
||||
- gitlink
|
||||
- project
|
||||
- issue
|
||||
- new_issue
|
||||
- usefixtures: gitlink_login
|
||||
- repeat(20)
|
||||
|
||||
case_info:
|
||||
-
|
||||
id: project_new_issue_001
|
||||
title: 项目内新建疑修接口
|
||||
run: True
|
||||
severity: normal
|
||||
url: /api/v1/${project_url}/issues
|
||||
method: POST
|
||||
headers: {"Content-Type": "application/json; charset=utf-8;"}
|
||||
cookies: ${cookies}
|
||||
request_type: json
|
||||
payload:
|
||||
subject: ${generate_company_name(lan='zh', fix='pre')}_${generate_words}
|
||||
description: ${generate_paragraph}
|
||||
branch_name: master
|
||||
status_id: 1
|
||||
priority_id: ${random.choice([1,2,3,4,5])}
|
||||
milestone_id:
|
||||
issue_tag_ids:
|
||||
assigner_ids:
|
||||
attachment_ids: # ["768f752b-2037-4b11-93e4-ccc8d72d2a54", "f5141121-6791-49b7-9334-79ebdbffeb3e"]
|
||||
- ${attachment_id}
|
||||
start_date: ${generate_today_date}
|
||||
due_date: {generate_time_after_week}
|
||||
receivers_login: []
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
assertId:
|
||||
message: 断言接口响应数据存在id
|
||||
assert_type: contains
|
||||
expect_value: id
|
||||
assert_sql:
|
||||
extract:
|
||||
type_jsonpath:
|
||||
issue_index: $.project_issues_index
|
||||
issue_title: $.subject
|
||||
issue_desc: $.description
|
||||
issue_files: $.attachments..title
|
||||
case_dependence:
|
||||
setup:
|
||||
interface: gitlink_upload_file_01
|
||||
@@ -25,7 +25,6 @@ case_info:
|
||||
payload:
|
||||
ref: master
|
||||
filepath:
|
||||
type: # 可选file或者dir
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
|
||||
@@ -18,7 +18,7 @@ case_info:
|
||||
url: /api/attachments.json
|
||||
method: POST
|
||||
headers:
|
||||
cookies: ${login_cookie}
|
||||
cookies: ${cookie}
|
||||
cookies:
|
||||
request_type: file
|
||||
payload:
|
||||
@@ -28,4 +28,4 @@ case_info:
|
||||
assert_sql:
|
||||
extract:
|
||||
type_jsonpath:
|
||||
file_id: $.id
|
||||
attachment_id: $.id
|
||||
|
||||
51
interface/gitlink/projects/wiki/test_new_wiki.yaml
Normal file
51
interface/gitlink/projects/wiki/test_new_wiki.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
case_common:
|
||||
allure_epic: GitLink接口
|
||||
allure_feature: 开源项目模块
|
||||
allure_story: Wiki
|
||||
case_markers:
|
||||
- gitlink
|
||||
- projects
|
||||
- gitea
|
||||
- new_wiki
|
||||
- usefixtures: gitlink_login
|
||||
|
||||
case_info:
|
||||
-
|
||||
id: gitlink_projects_new_wiki_01
|
||||
title: 新建wiki页面
|
||||
severity: critical
|
||||
run: True
|
||||
url: ${wiki_host}/api/wiki/createWiki
|
||||
method: POST
|
||||
headers:
|
||||
Content-Type: application/json; charset=utf-8;
|
||||
cookies: ${cookie}
|
||||
cookies:
|
||||
request_type: json
|
||||
payload:
|
||||
owner: ${repo_owner}
|
||||
repo: ${repo_identifier}
|
||||
projectId: ${project_id}
|
||||
pageName: 2023
|
||||
title: 2023
|
||||
message:
|
||||
content_base64: 5qyi6L+O5p2l5YiwV2lraQ==
|
||||
files:
|
||||
assert_response:
|
||||
status_code: 200
|
||||
commit_count:
|
||||
message: 断言接口返回的commit_count
|
||||
expect_value: 1
|
||||
assert_type: ==
|
||||
type_jsonpath: $.data.commit_count
|
||||
assertMessage:
|
||||
message: 断言接口返回的message
|
||||
expect_value: 201
|
||||
assert_type: ==
|
||||
type_jsonpath: $.message
|
||||
assert_sql:
|
||||
extract:
|
||||
case_dependence:
|
||||
setup:
|
||||
interface:
|
||||
- gitlink_projects_new_project_01
|
||||
@@ -5,6 +5,7 @@ case_common:
|
||||
allure_story: 登录接口 # 故事,可以理解为场景,相当于method级的标签, 往下是 title
|
||||
case_markers: # pytest框架的标记 pytest.mark.
|
||||
- gitlink
|
||||
- smoke
|
||||
- login: 登录接口
|
||||
|
||||
# 用例数据
|
||||
|
||||
Reference in New Issue
Block a user