docs: add more test cases of answer (#82)
Co-authored-by: Rick <linuxsuren@users.noreply.github.com>
This commit is contained in:
parent
73f8555d0e
commit
dc667845b9
|
@ -1,6 +1,7 @@
|
||||||
#!api-testing
|
#!api-testing
|
||||||
# yaml-language-server: $schema=https://gitee.com/linuxsuren/api-testing/raw/master/sample/api-testing-schema.json
|
# yaml-language-server: $schema=https://gitee.com/linuxsuren/api-testing/raw/master/sample/api-testing-schema.json
|
||||||
# see also https://github.com/answerdev/answer
|
# 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
|
name: Answer
|
||||||
api: http://localhost:9080/answer/api/v1
|
api: http://localhost:9080/answer/api/v1
|
||||||
items:
|
items:
|
||||||
|
@ -95,3 +96,67 @@ items:
|
||||||
{
|
{
|
||||||
"id": "{{.question.data.id}}"
|
"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}}"
|
Loading…
Reference in New Issue