core-legacy/test/tavern_tests/1.2.controllers_bad.tavern.yaml

100 lines
2.6 KiB
YAML
Raw Normal View History

2020-05-31 22:45:08 +00:00
test_name: Test bad controller functions
stages:
- name: "[controllers_bad] get controller with bad id"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/this_id_is_invalid"
response:
status_code: 400
- name: "[controllers_bad] put controller with bad id"
request:
method: PUT
url: "http://localhost:5000/api/v1/controllers/this_id_is_invalid"
json:
name: "unknown_controller"
response:
status_code: 400
- name: "[controllers_bad] delete controller with bad id"
request:
method: DELETE
url: "http://localhost:5000/api/v1/controllers/this_id_is_invalid"
json:
name: "unknown_controller"
response:
status_code: 400
- name: "[controllers_bad] get controller with unknown id"
request:
method: GET
url: "http://localhost:5000/api/v1/controllers/00000000-0000-0000-0000-000000000000"
response:
status_code: 404
- name: "[controllers_bad] put controller with unknown id"
request:
method: PUT
url: "http://localhost:5000/api/v1/controllers/00000000-0000-0000-0000-000000000000"
json:
name: "unknown_controller"
response:
status_code: 404
- name: "[controllers_bad] delete controller with unknown id"
request:
method: DELETE
url: "http://localhost:5000/api/v1/controllers/00000000-0000-0000-0000-000000000000"
json:
name: "unknown_controller"
response:
status_code: 404
- name: "[controllers_bad] get controllers to save valid id"
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"
- name: "[controllers_bad] put controller with bad body (invalid name)"
request:
method: PUT
url: "http://localhost:5000/api/v1/controllers/{returned_id}"
json:
name: NULL
response:
status_code: 400
- name: "[controllers_bad] put controller with bad body (invalid ip)"
request:
method: PUT
url: "http://localhost:5000/api/v1/controllers/{returned_id}"
json:
ip: 123
response:
status_code: 400
- name: "[controllers_bad] put controller with bad body (invalid IPv4)"
request:
method: PUT
url: "http://localhost:5000/api/v1/controllers/{returned_id}"
json:
ip: "10.0.0.300"
response:
status_code: 400
- name: "[controllers_bad] put controller with bad body (no json)"
request:
method: PUT
url: "http://localhost:5000/api/v1/controllers/{returned_id}"
data: "<b>not json</b><i>but html</i>"
response:
status_code: 400