新增用例:删除项目,修改用户手机号,修改用户密码,修改用户邮箱

This commit is contained in:
floraachy
2023-12-13 17:44:13 +08:00
parent 3c713a1ed3
commit 9db52bf23b
19 changed files with 519 additions and 63 deletions

View File

@@ -23,10 +23,10 @@ case_info:
pageSize: 10000
round: 2
files:
extract:
assert_response:
status_code: 200
assert_sql:
extract:
-
id: case_glcc_demo_02
@@ -43,7 +43,7 @@ case_info:
pageSize: 20
round: 2
files:
extract:
assert_response:
status_code: 200
assert_sql:
assert_sql:
extract:

View File

@@ -0,0 +1,70 @@
# 公共参数
case_common:
allure_epic: GitLink接口
allure_feature: 登录模块
allure_story: 登录接口
case_markers:
- gitlink
- login: 登录接口
# 用例数据
case_info:
-
id: gitlink_login_oauth_token_01
title: 用户登录(密码模式)
run: True
severity: normal
url: /oauth/token
method: POST
headers:
Content-Type: application/json; charset=utf-8;
cookies:
request_type: json
payload:
grant_type: password
username: ${login}
password: ${password}
client_id: ${client_id}
client_secret: ${client_secret}
files:
assert_response:
status_code: 200
access_token_in_response:
message: 断言接口返回中存在access_token字段
expect_value: access_token
assert_type: contains
assert_sql:
extract:
type_jsonpath:
access_token: $.access_token
token_type: $.token_type
token_expires_in: $.expires_in
-
id: gitlink_login_oauth_token_02
title: 用户登录(客户端模式)
run: True
severity: normal
url: /oauth/token
method: POST
headers:
Content-Type: application/json; charset=utf-8;
cookies:
request_type: json
payload:
grant_type: client_credentials
client_id: ${client_id}
client_secret: ${client_secret}
files:
assert_response:
status_code: 200
access_token_in_response:
message: 断言接口返回中存在access_token字段
expect_value: access_token
assert_type: contains
assert_sql:
extract:
type_jsonpath:
access_token: $.access_token
token_type: $.token_type
token_expires_in: $.expires_in

View File

@@ -0,0 +1,44 @@
# 公共参数
case_common:
allure_epic: GitLink接口
allure_feature: 开源项目模块
allure_story: 组织
case_markers:
- gitlink
- projects
- gitea
- new_organization
- usefixtures: get_oauth_token
- skip: 参数image还没处理好暂时略过
# 用例数据
case_info:
-
id: gitlink_projects_new_organization_01
title: 新建组织
severity: critical
run: True
url: /api/organizations.json
method: POST
headers:
Content-Type: application/json; charset=utf-8;
Authorization: ${token_type} ${access_token}
cookies:
request_type: json
payload:
name: ${generate_identifier()} # 组织标识
nickname: ${generate_words()} # 组织名称
description: ${generate_paragraph()} # 组织描述
location: ${generate_city(full=False)} # 组织地区
repo_admin_change_team_access: true # 项目管理员可以添加或移除团队的访问权限
image: ${} # 组织图片
visibility: common # 组织可见性默认值common
files:
assert_response:
status_code: 200
assert_id_in_response:
message: 断言响应数据中存在id字段
assert_type: contains
expect_value: id
assert_sql:
extract:

View File

@@ -0,0 +1,40 @@
case_common:
allure_epic: GitLink接口
allure_feature: 开源项目模块
allure_story: 项目
case_markers:
- gitlink
- projects
- gitea
- delete_project
- usefixtures: new_project
case_info:
-
id: gitlink_projects_delete_project_01
title: 删除项目
severity: critical
run: True
url: /api/${repo_owner}/${repo_identifier}.json
method: DELETE
headers:
Content-Type: application/json; charset=utf-8;
Authorization: ${token_type} ${access_token}
cookies:
request_type: json
payload:
files:
extract:
assert_response:
status_code: 200
assert_status:
message: 断言接口status=0
expect_value: 0
assert_type: ==
type_jsonpath: $.status
assert_message:
message: 断言接口message=success
expect_value: success
assert_type: ==
type_jsonpath: $.message
assert_sql:

View File

@@ -22,7 +22,7 @@ case_info:
request_type: params
payload:
files:
extract:
assert_response:
status_code: 200
assert_sql:
assert_sql:
extract:

View File

@@ -5,8 +5,11 @@ case_common:
allure_story: 项目 # 故事可以理解为场景相当于method级的标签, 往下是 title
case_markers:
- gitlink
- projects
- gitea
- new_project
- usefixtures: gitlink_login
- usefixtures: get_oauth_token
- usefixtures: delete_project
# 用例数据
case_info:
@@ -19,7 +22,7 @@ case_info:
method: POST
headers:
Content-Type: application/json; charset=utf-8;
cookies: ${cookies}
Authorization: ${token_type} ${access_token}
cookies:
request_type: json
payload:
@@ -27,11 +30,6 @@ case_info:
name: ${generate_name(lan='zh')}_${generate_identifier()}
repository_name: ${generate_identifier()}
files:
extract:
type_jsonpath:
project_id: $.id
project_name: $.name
project_identifier: $.identifier
assert_response:
status_code: 200
login:
@@ -40,6 +38,12 @@ case_info:
assert_type: ==
type_jsonpath: $.login
assert_sql:
extract:
type_jsonpath:
repo_id: $.id
repo_name: $.name
repo_owner: $.login
repo_identifier: $.identifier
-
id: gitlink_projects_new_project_02
@@ -74,11 +78,6 @@ case_info:
blockchain_init_token:
auth_password:
files:
extract:
type_jsonpath:
project_id: $.id
project_name: $.name
project_identifier: $.identifier
assert_response:
status_code: 200
login:
@@ -87,6 +86,12 @@ case_info:
assert_type: ==
type_jsonpath: $.login
assert_sql:
extract:
type_jsonpath:
repo_id: $.id
repo_name: $.name
repo_owner: $.login
repo_identifier: $.identifier
-
id: gitlink_projects_new_project_03
@@ -104,11 +109,6 @@ case_info:
name: ${generate_name(lan='zh')}_${generate_identifier()}
repository_name: ${generate_identifier()}
files:
extract:
type_re:
project_id: $.id
project_name: $.name
project_identifier: $.identifier
assert_response:
status_code: 200
login:
@@ -121,4 +121,10 @@ case_info:
sql: select id,`name`, identifier from projects where user_id=${user_id} ORDER BY created_on DESC;
$.id: ${project_id}
$.name: ${project_name}
$.identifier: ${project_identifier}
$.identifier: ${project_identifier}
extract:
type_jsonpath:
repo_id: $.id
repo_name: $.name
repo_owner: $.login
repo_identifier: $.identifier

View File

@@ -23,9 +23,9 @@ case_info:
request_type: file
payload:
files: TOC出库订单导入模板(2).xlsx
extract:
type_jsonpath:
file_id: $.id
assert_response:
status_code: 200
assert_sql:
extract:
type_jsonpath:
file_id: $.id

View File

@@ -25,13 +25,6 @@ case_info:
password: ${password}
autologin: 1
files:
extract:
type_re:
nickname: \"username":"(.*?)"
login: \"login":"(.*?)"
user_id: \"user_id":(.*?),
type_response:
cookies: response.cookies
assert_response:
status_code: 200
user_id:
@@ -45,6 +38,13 @@ case_info:
assert_type: ==
type_jsonpath: $.login
assert_sql:
extract:
type_re:
nickname: \"username":"(.*?)"
login: \"login":"(.*?)"
user_id: \"user_id":(.*?),
type_response:
cookies: response.cookies
-
id: case_login_02
@@ -62,11 +62,6 @@ case_info:
password: ${password}
autologin: 1
files:
extract:
type_jsonpath:
nickname: $.username
login: $.login
user_id: $.user_id
assert_response:
status_code: 200
user_id:
@@ -96,6 +91,11 @@ case_info:
type_re: "'user_id': (.*?),"
expect_value: ${user_id}
assert_type: contains
extract:
type_jsonpath:
nickname: $.username
login: $.login
user_id: $.user_id
-
id: case_login_03
@@ -113,7 +113,6 @@ case_info:
password: 12345678900
autologin: 1
files:
extract:
assert_response:
status_code: 200
user_id:
@@ -122,3 +121,4 @@ case_info:
assert_type: ==
type_jsonpath: $.status
assert_sql:
extract:

View File

@@ -0,0 +1,45 @@
# 公共参数
case_common:
allure_epic: GitLink接口
allure_feature: 用户
allure_story: 账号管理
case_markers:
- gitlink
- gitea
- change_email
- login: 登录接口
- usefixtures: get_oauth_token
# 用例数据
case_info:
-
id: gitlink_user_change_email_01
title: 用户修改邮箱
run: True
severity: normal
url: api/v1/${login}/update_email.json
method: PATCH
headers:
Content-Type: application/json; charset=utf-8;
Authorization: ${token_type} ${access_token}
cookies:
request_type: json
payload:
email: ${generate_email()}
password: ${password}
code: ${green_code}
files:
assert_response:
status_code: 200
assert_status:
message: 断言接口status=0
expect_value: 0
assert_type: ==
type_jsonpath: $.status
assert_message:
message: 断言接口message=success
expect_value: success
assert_type: ==
type_jsonpath: $.message
assert_sql:
extract:

View File

@@ -0,0 +1,80 @@
# 公共参数
case_common:
allure_epic: GitLink接口
allure_feature: 用户
allure_story: 账号管理
case_markers:
- gitlink
- gitea
- change_pwd
- login: 登录接口
- usefixtures: get_oauth_token
- skip: 跳过执行该用例
# 用例数据
case_info:
-
id: gitlink_user_change_password_01
title: 用户修改密码, 新密码和确认密码一致,修改成功
run: True
severity: normal
url: /api/accounts/change_password.json
method: POST
headers:
Content-Type: application/json; charset=utf-8;
Authorization: ${token_type} ${access_token}
cookies:
request_type: json
payload:
login: ${login}
old_password: ${password} # 原始密码
password: ${password} # 新密码
new_password_repeat: ${password} # 确认密码
files:
assert_response:
status_code: 200
assert_status:
message: 断言接口status=0
expect_value: 0
assert_type: ==
type_jsonpath: $.status
assert_message:
message: 断言接口message=success
expect_value: success
assert_type: ==
type_jsonpath: $.message
assert_sql:
extract:
-
id: gitlink_user_change_password_02
title: 用户修改密码, 新密码和确认密码不一致,修改失败
run: True
severity: normal
url: /api/accounts/change_password.json
method: POST
headers:
Content-Type: application/json; charset=utf-8;
Authorization: ${token_type} ${access_token}
cookies:
request_type: json
payload:
login: ${login}
old_password: ${password} # 原始密码
password: ${generate_identifier()} # 新密码
new_password_repeat: ${generate_identifier()} # 确认密码
files:
assert_response:
status_code: 200
assert_status:
message: 断言接口status=-2
expect_value: -2
assert_type: ==
type_jsonpath: $.status
assert_message:
message: 断言接口message=success
expect_value: 新密码与确认密码不一致
assert_type: ==
type_jsonpath: $.message
assert_sql:
extract:

View File

@@ -0,0 +1,44 @@
# 公共参数
case_common:
allure_epic: GitLink接口
allure_feature: 用户
allure_story: 账号管理
case_markers:
- gitlink
- change_phone
- login: 登录接口
- usefixtures: get_oauth_token
# 用例数据
case_info:
-
id: gitlink_user_change_phone_01
title: 用户修改手机号码
run: True
severity: normal
url: api/v1/${login}/update_phone.json
method: PATCH
headers:
Content-Type: application/json; charset=utf-8;
Authorization: ${token_type} ${access_token}
cookies:
request_type: json
payload:
phone: ${generate_phone(lan='zh')}
password: ${password}
code: ${green_code}
files:
assert_response:
status_code: 200
assert_status:
message: 断言接口status=0
expect_value: 0
assert_type: ==
type_jsonpath: $.status
assert_message:
message: 断言接口message=success
expect_value: success
assert_type: ==
type_jsonpath: $.message
assert_sql:
extract: