core-legacy/tests/tavern_tests/2.1.schedules_protected.tavern.yaml

73 lines
2 KiB
YAML

test_name: Test protected schedules requests
stages:
- name: "[schedules_protected] delete protected off schedule; expect forbidden/fail"
request:
method: DELETE
url: "http://localhost:5000/api/v1/schedules/off"
response:
status_code: 403
- name: "[schedules_protected] get protected off schedule"
request:
method: GET
url: "http://localhost:5000/api/v1/schedules/off"
response:
status_code: 200
verify_response_with:
function: validate_schedule:single
function: validate_schedule:compare_off
- name: "[schedules_protected] overwrite protected off schedule"
request:
method: PUT
url: "http://localhost:5000/api/v1/schedules/off"
json:
name: "turned_off"
periods:
- start: "00:10"
end: "00:20"
response:
status_code: 200
verify_response_with:
function: validate_schedule:single
function: validate_schedule:compare_off
function: validate_schedule:check_name
extra_kwargs:
name: "{tavern.request_vars.json.name}"
- name: "[schedules_protected] delete protected on schedule; expect forbidden/fail"
request:
method: DELETE
url: "http://localhost:5000/api/v1/schedules/on"
response:
status_code: 403
- name: get protected on schedule
request:
method: GET
url: "http://localhost:5000/api/v1/schedules/on"
response:
status_code: 200
verify_response_with:
function: validate_schedule:single
function: validate_schedule:compare_on
- name: "[schedules_protected] overwrite protected on schedule"
request:
method: PUT
url: "http://localhost:5000/api/v1/schedules/on"
json:
name: "turned_on"
periods:
- start: "16:10"
end: "17:20"
response:
status_code: 200
verify_response_with:
function: validate_schedule:single
function: validate_schedule:compare_on
function: validate_schedule:check_name
extra_kwargs:
name: "{tavern.request_vars.json.name}"