core-legacy/tests/tavern_tests/controllers_basic.tavern.yaml

105 lines
2.4 KiB
YAML

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
json:
- id: !anystr
name: !anystr
relay_count: !anyint
relays: !anystr
active: !anybool
port: !anyint
ip: !anystr
relays: !anylist
save:
json:
returned_name: "[0].name"
returned_id: "[0].id"
- name: "[controllers_basic] get controller, check name"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/{returned_id}"
response:
status_code: 200
json:
name: "{returned_name}"
id: "{returned_id}"
relay_count: !anyint
relays: !anystr
active: !anybool
port: !anyint
ip: !anystr
relays: !anylist
- name: "[controllers_basic] get controller, check name"
request:
method: PUT
url: "http://localhost:5000/api/v1/controllers/{returned_id}"
json:
name: "renamed_controller"
response:
status_code: 200
json:
name: "{tavern.request_vars.json.name}"
id: "{returned_id}"
relay_count: !anyint
relays: !anystr
active: true
port: !anyint
ip: !anystr
relays: !anylist
save:
json:
changed_name: "name"
- 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
json:
- id: "{returned_id}"
name: "{changed_name}"
relay_count: !anyint
relays: !anystr
active: true
port: !anyint
ip: !anystr
relays: !anylist
- name: "[controllers_basic] get controller again, check name"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/{returned_id}"
response:
status_code: 200
json:
id: "{returned_id}"
name: "{changed_name}"
relay_count: !anyint
relays: !anystr
active: true
port: !anyint
ip: !anystr
relays: !anylist