core/tests/tavern_tests/1.0.controllers_basic.tavern.yaml

117 lines
3.2 KiB
YAML
Raw Normal View History

test_name: Test basic controller functions
stages:
- name: "[controllers_basic] discover controllers"
request:
method: POST
url: "http://localhost:5000/api/v1/controllers/discover/"
response:
status_code: 200
verify_response_with:
function: validate_controller:multiple
save:
json:
returned_name: "[0].name"
returned_id: "[0].id"
returned_ip: "[0].ip"
- name: "[controllers_basic] get controller, check name"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/{returned_id}"
response:
status_code: 200
verify_response_with:
function: validate_controller:single
function: validate_controller:check_id
extra_kwargs:
id: "{returned_id}"
function: validate_controller:check_name
extra_kwargs:
name: "{returned_name}"
- name: "[controllers_basic] put controller, check name"
request:
method: PUT
url: "http://localhost:5000/api/v1/controllers/{returned_id}"
json:
name: "renamed_controller"
response:
status_code: 200
verify_response_with:
function: validate_controller:single
function: validate_controller:check_id
extra_kwargs:
id: "{returned_id}"
function: validate_controller:check_name
extra_kwargs:
name: "{tavern.request_vars.json.name}"
save:
json:
changed_name: "name"
#- name: "[controllers_basic] put controller, check name and ip"
# request:
# method: PUT
# url: "http://localhost:5000/api/v1/controllers/{returned_id}"
# json:
# ip: "203.0.113.17"
# response:
# status_code: 200
# verify_response_with:
# function: validate_controller:single
# function: validate_controller:check_id
# extra_kwargs:
# id: "{returned_id}"
# function: validate_controller:check_ip
# extra_kwargs:
# ip: "{tavern.request_vars.json.ip}"
# save:
# json:
# changed_ip: "ip"
- name: "[controllers_basic] delete controller"
request:
method: DELETE
url: "http://localhost:5000/api/v1/controllers/{returned_id}"
response:
status_code: 200
- name: "[controllers_basic] get controller, expect 404"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/{returned_id}"
response:
status_code: 404
- name: "[controllers_basic] discover controllers again"
request:
method: POST
url: "http://localhost:5000/api/v1/controllers/discover/"
response:
status_code: 200
verify_response_with:
function: validate_controller:multiple
function: validate_controller:find
extra_kwargs:
id: "{returned_id}"
name: "{changed_name}"
- name: "[controllers_basic] get controller again, check name"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/{returned_id}"
response:
status_code: 200
verify_response_with:
function: validate_controller:single
function: validate_controller:check_id
extra_kwargs:
id: "{returned_id}"
function: validate_controller:check_name
extra_kwargs:
name: "{changed_name}"
function: validate_controller:check_ip
extra_kwargs:
ip: "{returned_ip}"