1
1
# !api-testing
2
2
# yaml-language-server: $schema=https://gitee.com/linuxsuren/api-testing/raw/master/sample/api-testing-schema.json
3
3
# see also https://github.com/answerdev/answer
4
+ # start via docker run -d -p 9080:80 -v answer-data:/data --name answer answerdev/answer:1.1.0
4
5
name : Answer
5
6
api : http://localhost:9080/answer/api/v1
6
7
items :
@@ -95,3 +96,67 @@ items:
95
96
{
96
97
"id": "{{.question.data.id}}"
97
98
}
99
+ - name : search-nagetive-page
100
+ request :
101
+ api : /search?q=abc&order=active&page={{randInt -10 0}}&size=20
102
+ header :
103
+ Content-Type : application/json
104
+ Authorization : " {{.login.data.access_token}}"
105
+ expect :
106
+ statusCode : 400
107
+ bodyFieldsExpect :
108
+ msg : " page must be 1 or greater"
109
+ - name : search-nagetive-size
110
+ request :
111
+ api : /search?q=abc&order=active&page=1&size={{randInt -10 0}}
112
+ header :
113
+ Content-Type : application/json
114
+ Authorization : " {{.login.data.access_token}}"
115
+ expect :
116
+ statusCode : 400
117
+ bodyFieldsExpect :
118
+ msg : " size must be 1 or greater"
119
+ - name : search-wrong-order
120
+ request :
121
+ api : /search?q=abc&order={{randAlpha 6}}&page=1&size=10
122
+ header :
123
+ Content-Type : application/json
124
+ Authorization : " {{.login.data.access_token}}"
125
+ expect :
126
+ statusCode : 400
127
+ bodyFieldsExpect :
128
+ msg : " order must be one of [newest active score relevance]"
129
+ - name : search-not-found
130
+ request :
131
+ api : /search?q={{randAlpha 16}}&order={{index (list "newest" "active" "score" "relevance") (randInt 0 3)}}&page=1&size=10
132
+ header :
133
+ Content-Type : application/json
134
+ Authorization : " {{.login.data.access_token}}"
135
+ expect :
136
+ bodyFieldsExpect :
137
+ data/count : 0
138
+ - name : tags
139
+ request :
140
+ api : /tags/page?page=1&page_size=20&query_cond={{index (list "newest" "popular" "name") (randInt 0 2)}}
141
+ header :
142
+ Content-Type : application/json
143
+ Authorization : " {{.login.data.access_token}}"
144
+ expect :
145
+ bodyFieldsExpect :
146
+ data/count : 1
147
+ - name : tags-invalid-cond
148
+ request :
149
+ api : /tags/page?page=1&page_size=20&query_cond={{randAlpha 16}}
150
+ header :
151
+ Content-Type : application/json
152
+ Authorization : " {{.login.data.access_token}}"
153
+ expect :
154
+ statusCode : 400
155
+ bodyFieldsExpect :
156
+ msg : query_cond must be one of [popular name newest]
157
+ - name : user-ranking
158
+ request :
159
+ api : /user/ranking
160
+ header :
161
+ Content-Type : application/json
162
+ Authorization : " {{.login.data.access_token}}"
0 commit comments