98 lines
2.4 KiB
YAML
98 lines
2.4 KiB
YAML
#!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}}"
|
|
}
|