Files
2016-12-21 15:33:49 +00:00

86 lines
2.0 KiB
YAML

# Make reference to prior request response data via json path.
#
tests:
- name: post some json
url: /posterchild
request_headers:
content-type: application/json
data: '{"a": 1, "b": 2, "link": "/v2"}'
method: POST
response_json_paths:
a: 1
b: 2
link: "/v2"
response_headers:
location: $SCHEME://$NETLOC/posterchild
- name: post some more json
url: $RESPONSE["link"]
request_headers:
content-type: application/json
method: POST
data:
a: $RESPONSE['a']
c: $RESPONSE['link']
d:
z: $RESPONSE['b']
response_json_paths:
a: $RESPONSE["a"]
c: /v2
d:
z: $RESPONSE['b']
response_headers:
x-gabbi-url: $SCHEME://$NETLOC/v2
- name: post even more json
url: $RESPONSE['c']
request_headers:
content-type: application/json
method: POST
data: |
{"a": "$RESPONSE['a']",
"c": "$RESPONSE['c']"}
response_strings:
- '"a": "$RESPONSE[''a'']"'
- '"c": "/v2"'
response_headers:
location: $SCHEME://$NETLOC$RESPONSE['c']
x-gabbi-url: $SCHEME://$NETLOC/v2
content-type: $HEADERS['content-type']
- name: post even more json quote different
url: $RESPONSE["c"]
request_headers:
content-type: application/json
method: POST
data: |
{"a": "$RESPONSE["a"]",
"c": "$RESPONSE["c"]"}
response_strings:
- '"a": "$RESPONSE["a"]"'
- '"c": "/v2"'
response_headers:
location: $SCHEME://$NETLOC$RESPONSE['c']
x-gabbi-url: $SCHEME://$NETLOC/v2
content-type: $HEADERS['content-type']
- name: backref json fail start
url: /
method: POST
data: ''
- name: backref json fail end
xfail: true
url: $RESPONSE['url']
- name: get a historical response
GET: /$HISTORY['post some json'].$RESPONSE['a']
response_headers:
x-gabbi-url: $SCHEME://$NETLOC/1
- name: get a historical response via jsonpath
GET: /$HISTORY['post some json'].$RESPONSE['$.b']
response_headers:
x-gabbi-url: $SCHEME://$NETLOC/2