core-legacy/tests/tavern_tests/1.1.controller_relays_basic.tavern.yaml
2020-08-29 09:10:50 +02:00

108 lines
3.1 KiB
YAML

test_name: Test basic controller relays functions
stages:
- name: "[controller_relays_basic] get controllers"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/"
response:
status_code: 200
verify_response_with:
function: validate_controller:multiple
save:
json:
returned_id: "[0].id"
returned_relay_count: "[0].relay_count"
- name: "[controller_relays_basic] get controller relays, check length"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/{returned_id}/relays"
response:
status_code: 200
verify_response_with:
function: validate_relay:multiple
function: validate_relay:relay_count
extra_kwargs:
relay_count: !int "{returned_relay_count:d}"
- name: "[controller_relays_basic] get controller relay"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/{returned_id}/relays/5"
response:
status_code: 200
verify_response_with:
function: validate_relay:single
function: validate_relay:check_controller_id
extra_kwargs:
name: "{returned_id}"
function: validate_relay:check_number
extra_kwargs:
number: 5
- name: "[controller_relays_basic] get controller relay with invalid uid"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/INVALID-UUID/relays/5"
response:
status_code: 400
- name: "[controller_relays_basic] get controller relay with unavailable uid"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/00000000-0000-0000-0000-000000000000/relays/5"
response:
status_code: 404
- name: "[controller_relays_basic] get controller relay with invalid number"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/{returned_id}/relays/not_a_number"
response:
status_code: 404
- name: "[controller_relays_basic] get controller relay with unavailable number"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/{returned_id}/relays/9001"
response:
status_code: 404
- name: "[controller_relays_basic] pulse relay"
request:
method: POST
url: "http://localhost:5000/api/v1/controllers/{returned_id}/relays/6/pulse"
response:
status_code: 200
- name: "[controller_relays_basic] pulse relay with invalid uid"
request:
method: POST
url: "http://localhost:5000/api/v1/controllers/INVALID-UUID/relays/6/pulse"
response:
status_code: 400
- name: "[controller_relays_basic] pulse relay with unavailable uid"
request:
method: POST
url: "http://localhost:5000/api/v1/controllers/00000000-0000-0000-0000-000000000000/relays/6/pulse"
response:
status_code: 404
- name: "[controller_relays_basic] pulse relay with invalid number"
request:
method: POST
url: "http://localhost:5000/api/v1/controllers/{returned_id}/relays/not_a_number/pulse"
response:
status_code: 404
- name: "[controller_relays_basic] pulse relay with unavailable number"
request:
method: POST
url: "http://localhost:5000/api/v1/controllers/{returned_id}/relays/9001/pulse"
response:
status_code: 404