Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions sample/answer.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!api-testing
# yaml-language-server: $schema=https://gitee.com/linuxsuren/api-testing/raw/master/sample/api-testing-schema.json
# see also https://github.com/answerdev/answer
# start via docker run -d -p 9080:80 -v answer-data:/data --name answer answerdev/answer:1.1.0
name: Answer
api: http://localhost:9080/answer/api/v1
items:
Expand Down Expand Up @@ -95,3 +96,67 @@ items:
{
"id": "{{.question.data.id}}"
}
- name: search-nagetive-page
request:
api: /search?q=abc&order=active&page={{randInt -10 0}}&size=20
header:
Content-Type: application/json
Authorization: "{{.login.data.access_token}}"
expect:
statusCode: 400
bodyFieldsExpect:
msg: "page must be 1 or greater"
- name: search-nagetive-size
request:
api: /search?q=abc&order=active&page=1&size={{randInt -10 0}}
header:
Content-Type: application/json
Authorization: "{{.login.data.access_token}}"
expect:
statusCode: 400
bodyFieldsExpect:
msg: "size must be 1 or greater"
- name: search-wrong-order
request:
api: /search?q=abc&order={{randAlpha 6}}&page=1&size=10
header:
Content-Type: application/json
Authorization: "{{.login.data.access_token}}"
expect:
statusCode: 400
bodyFieldsExpect:
msg: "order must be one of [newest active score relevance]"
- 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:
Content-Type: application/json
Authorization: "{{.login.data.access_token}}"
expect:
bodyFieldsExpect:
data/count: 0
- name: tags
request:
api: /tags/page?page=1&page_size=20&query_cond={{index (list "newest" "popular" "name") (randInt 0 2)}}
header:
Content-Type: application/json
Authorization: "{{.login.data.access_token}}"
expect:
bodyFieldsExpect:
data/count: 1
- name: tags-invalid-cond
request:
api: /tags/page?page=1&page_size=20&query_cond={{randAlpha 16}}
header:
Content-Type: application/json
Authorization: "{{.login.data.access_token}}"
expect:
statusCode: 400
bodyFieldsExpect:
msg: query_cond must be one of [popular name newest]
- name: user-ranking
request:
api: /user/ranking
header:
Content-Type: application/json
Authorization: "{{.login.data.access_token}}"