Files
apiautotest/interface/gitlink/projects/test_gitlink_upload_files.yaml
2025-12-25 15:48:21 +08:00

64 lines
1.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 公共参数
config:
epic: GitLink接口
feature: 开源项目模块
story: 上传文件
pytest_markers:
- gitlink
- upload_file
- usefixtures: gitlink_login
# 用例数据
teststeps:
- id: gitlink_upload_file_01
title: 正常上传文件
severity:
run: true
url: /api/attachments.json
method: POST
headers:
Cookie: ${cookies}
Content-Type: application/json; charset=utf-8;
cookies:
request_type: file
payload:
files: TOC出库订单导入模板(2).xlsx
validate:
status_code: 200
asserFileName:
message: 断言接口返回的filename
expect_value: TOC出库订单导入模板(2).xlsx
assert_type: ==
type_jsonpath: $.title
extract:
type_jsonpath:
attachment_id: $.id
# 由于requests采用的是session方式fixture执行了login后会产生cookies session会记录cookies。因此下述用例虽然没用传登录cookies,但是实际有,会上传成功。暂时还没想好如何解决这一问题
- id: gitlink_upload_file_02
title: 无用户登录信息上传文件,提示用户先登录
severity:
run: True
url: /api/attachments.json
method: POST
headers:
Content-Type: application/json; charset=utf-8;
cookies:
request_type: file
payload:
files: TOC出库订单导入模板(2).xlsx
validate:
status_code: 200
assertStatus:
message: 断言接口返回的status
expect_value: 401
assert_type: ==
type_jsonpath: $.status
assertMessage:
message: 断言接口返回的message
expect_value: 请登录后再操作
assert_type: ==
type_jsonpath: $.message
extract: