1 Star 4 Fork 0

Rick/api-testing-hub

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
answer.yaml 4.30 KB
一键复制 编辑 原始数据 按行查看 历史
LinuxSuRen 提交于 2023-10-19 21:36 +08:00 . auto commit by api-testing
#!api-testing
# yaml-language-server: $schema=https://linuxsuren.github.io/api-testing/api-testing-schema.json
api: https://meta.answer.dev/answer/api/v1
items:
- expect:
statusCode: 200
verify:
- ""
name: status
request:
api: /notification/status
header:
Authorization: '{{.login.data.access_token}}'
Content-Type: application/json
good: gdd
method: GET
- expect:
bodyFieldsExpect:
data/content: good-body
name: question
request:
api: /question
body: |
{
"title": "{{randomKubernetesName}}",
"content": "good-body",
"tags": [
{
"slug_name": "test",
"display_name": "test",
"original_text": "",
"parsed_text": ""
}
]
}
header:
Authorization: '{{.login.data.access_token}}'
Content-Type: application/json
method: POST
- expect: {}
name: answer
request:
api: /answer
body: |
{
"question_id": "{{.question.data.id}}",
"content": "12121212",
"html": "<p>12121212</p>\n"
}
header:
Authorization: '{{.login.data.access_token}}'
Content-Type: application/json
method: POST
- before:
items:
- sleep("1s")
expect: {}
name: acceptance
request:
api: /answer/acceptance
body: |
{
"question_id": "{{.question.data.id}}",
"answer_id": "{{.answer.data.info.id}}"
}
header:
Authorization: '{{.login.data.access_token}}'
Content-Type: application/json
method: POST
- expect: {}
name: delAnswer
request:
api: /answer
body: |
{
"id": "{{.answer.data.info.id}}"
}
header:
Authorization: '{{.login.data.access_token}}'
Content-Type: application/json
method: DELETE
- expect: {}
name: delQuestion
request:
api: /question
body: |
{
"id": "{{.question.data.id}}"
}
header:
Authorization: '{{.login.data.access_token}}'
Content-Type: application/json
method: DELETE
- expect:
bodyFieldsExpect:
msg: page must be 1 or greater
statusCode: 400
name: search-nagetive-page
request:
api: /search?q=abc&order=active&page={{randInt -10 0}}&size=20
header:
Authorization: '{{.login.data.access_token}}'
Content-Type: application/json
- expect:
bodyFieldsExpect:
msg: size must be 1 or greater
statusCode: 400
name: search-nagetive-size
request:
api: /search?q=abc&order=active&page=1&size={{randInt -10 0}}
header:
Authorization: '{{.login.data.access_token}}'
Content-Type: application/json
- expect:
bodyFieldsExpect:
msg: order must be one of [newest active score relevance]
statusCode: 400
name: search-wrong-order
request:
api: /search?q=abc&order={{randAlpha 6}}&page=1&size=10
header:
Authorization: '{{.login.data.access_token}}'
Content-Type: application/json
- expect:
bodyFieldsExpect:
data/count: 0
name: search-not-found
request:
api: /search?q={{randAlpha 16}}&order={{index (list "newest" "active" "score"
"relevance") (randInt 0 3)}}&page=1&size=10
header:
Authorization: '{{.login.data.access_token}}'
Content-Type: application/json
- expect:
bodyFieldsExpect:
data/count: 1
name: tags
request:
api: /tags/page?page=1&page_size=20&query_cond={{index (list "newest" "popular"
"name") (randInt 0 2)}}
header:
Authorization: '{{.login.data.access_token}}'
Content-Type: application/json
- expect:
bodyFieldsExpect:
msg: query_cond must be one of [popular name newest]
statusCode: 400
name: tags-invalid-cond
request:
api: /tags/page?page=1&page_size=20&query_cond={{randAlpha 16}}
header:
Authorization: '{{.login.data.access_token}}'
Content-Type: application/json
- expect: {}
name: user-ranking
request:
api: /user/ranking
header:
Authorization: '{{.login.data.access_token}}'
Content-Type: application/json
- expect:
statusCode: 200
name: login
request:
api: /user/login/email
body: |-
{
"e_mail": "{{.param.email}}",
"pass": "{{.param.pass}}"
}
header:
Content-Type: application/json
method: POST
name: Answer
param:
email: a@q.com
pass: "123"
spec: {}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/linuxsuren/api-testing-hub.git
git@gitee.com:linuxsuren/api-testing-hub.git
linuxsuren
api-testing-hub
api-testing-hub
master

搜索帮助