-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support to reference in the request body (#79)
* feat: support to reference in the request body * add more test cases of answer platform --------- Co-authored-by: Rick <linuxsuren@users.noreply.github.com>
- Loading branch information
1 parent
7680987
commit 09b5860
Showing
6 changed files
with
160 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!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 | ||
name: Answer | ||
api: http://localhost:9080/answer/api/v1 | ||
items: | ||
- name: login | ||
request: | ||
api: /user/login/email | ||
method: POST | ||
header: | ||
Content-Type: application/json | ||
body: | | ||
{ | ||
"e_mail": "admin@ad.com", | ||
"pass": "admin123" | ||
} | ||
- name: status | ||
request: | ||
api: /notification/status | ||
method: GET | ||
header: | ||
Content-Type: application/json | ||
Authorization: "{{.login.data.access_token}}" | ||
- name: question | ||
request: | ||
api: /question | ||
method: POST | ||
header: | ||
Content-Type: application/json | ||
Authorization: "{{.login.data.access_token}}" | ||
body: | | ||
{ | ||
"title": "{{randomKubernetesName}}", | ||
"content": "good-body", | ||
"tags": [ | ||
{ | ||
"slug_name": "test", | ||
"display_name": "test", | ||
"original_text": "", | ||
"parsed_text": "" | ||
} | ||
] | ||
} | ||
expect: | ||
bodyFieldsExpect: | ||
data/content: good-body | ||
- name: answer | ||
request: | ||
api: /answer | ||
method: POST | ||
header: | ||
Authorization: "{{.login.data.access_token}}" | ||
Content-Type: application/json | ||
body: | | ||
{ | ||
"question_id": "{{.question.data.id}}", | ||
"content": "12121212", | ||
"html": "<p>12121212</p>\n" | ||
} | ||
- name: acceptance | ||
before: | ||
items: | ||
- sleep("1s") | ||
request: | ||
api: /answer/acceptance | ||
method: POST | ||
header: | ||
Authorization: "{{.login.data.access_token}}" | ||
Content-Type: application/json | ||
body: | | ||
{ | ||
"question_id": "{{.question.data.id}}", | ||
"answer_id": "{{.answer.data.info.id}}" | ||
} | ||
- name: delAnswer | ||
request: | ||
api: /answer | ||
method: DELETE | ||
header: | ||
Authorization: "{{.login.data.access_token}}" | ||
Content-Type: application/json | ||
body: | | ||
{ | ||
"id": "{{.answer.data.info.id}}" | ||
} | ||
- name: delQuestion | ||
request: | ||
api: /question | ||
method: DELETE | ||
header: | ||
Content-Type: application/json | ||
Authorization: "{{.login.data.access_token}}" | ||
body: | | ||
{ | ||
"id": "{{.question.data.id}}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!api-testing | ||
# yaml-language-server: $schema=https://gitee.com/linuxsuren/api-testing/raw/master/sample/api-testing-schema.json | ||
# see also https://github.com/halo-dev/halo | ||
name: Halo | ||
api: https://demo.halo.run | ||
items: | ||
- name: publickey | ||
request: | ||
api: /login/public-key | ||
method: GET | ||
- name: login | ||
request: | ||
api: /login | ||
method: POST | ||
body: | | ||
{ | ||
"username": "demo", | ||
"password": "P@ssw0rd123" | ||
} | ||
expect: | ||
statusCode: 500 |