core-legacy/tests/test_controllers_basic.tavern.yaml

106 lines
2.5 KiB
YAML
Raw Normal View History

2020-05-10 20:37:55 +00:00
test_name: Test basic controller functions
stages:
- name: "[test_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: "[test_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: "[test_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: "[test_controllers_basic] delete controller"
request:
method: DELETE
url: "http://localhost:5000/api/v1/controllers/{returned_id}"
response:
status_code: 200
- name: "[test_controllers_basic] get controller, expect 404"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/{returned_id}"
response:
status_code: 404
- name: "[test_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: "[test_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