1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
#
# Tests for testing gabbi, using the built in SimpleWsgi app.
#
defaults:
url: /cow?alpha=1
request_headers:
x-random-header: ya
tests:
- name: get simple page
url: /
verbose: True
- name: inheritance of defaults
response_headers:
x-gabbi-url: $SCHEME://$NETLOC/cow?alpha=1
response_strings:
- '"alpha": ["1"]'
response_json_paths:
alpha[0]: "1"
- name: bogus method
url: /
method: UNREAL
status: 405
response_headers:
allow: GET, PUT, POST, DELETE, PATCH
x-gabbi-method: UNREAL
x-gabbi-url: $SCHEME://$NETLOC/
- name: query returned
url: /somewhere?foo=1&bar=2&bar=3
response_strings:
- "\"bar\": [\"2\", \"3\"]"
response_json_paths:
bar:
- "2"
- "3"
- name: simple post
url: /named/thing
method: POST
response_headers:
location: $SCHEME://$NETLOC/named/thing
- name: use prior location
url: $LOCATION
response_headers:
x-gabbi-url: $SCHEME://$NETLOC/named/thing
- name: use a historical location
url: $HISTORY['simple post'].$LOCATION
response_headers:
x-gabbi-url: $SCHEME://$NETLOC/named/thing
- name: checklimit
url: /
- name: post a body
url: /somewhere
method: POST
data:
cow: barn
request_headers:
content-type: application/json
response_json_paths:
$.cow: barn
- name: get location from headers
url: $HEADERS['locaTion']
response_headers:
x-gabbi-url: $SCHEME://$NETLOC/somewhere
- name: get historical location from headers
url: $HISTORY['post a body'].$HEADERS['locaTion']
response_headers:
x-gabbi-url: $SCHEME://$NETLOC/somewhere
- name: post a body with query
url: /somewhere?chicken=coop
method: POST
data:
cow: barn
request_headers:
content-type: application/json
response_json_paths:
$.cow: barn
$.chicken[0]: coop
- name: get ssl page
url: /
ssl: True
response_headers:
x-gabbi-url: https://$NETLOC/
- name: test binary handling
url: /
request_headers:
accept: image/png
response_headers:
content-type: image/png
- name: confirm environ
url: /$ENVIRON['GABBI_TEST_URL']
response_headers:
x-gabbi-url: $SCHEME://$NETLOC/takingnames
- name: confirm environ no key fail
desc: this confirms that no key leads to failure rather than error
xfail: true
url: /$ENVIRON['1385F1EB-DC5C-4A95-8928-58673FB272DC']
- name: test pluggable response
url: /foo?alpha=1
response_test:
- 'COW"alpha": ["1"]'
- COWAnother line
- name: fail pluggable response
desc: this one will fail because COW is not removable
url: /foo?alpha=1
xfail: true
response_test:
- 'CO"alpha": ["1"]'
- name: test exception wrapper
desc: simple wsgi will raise exception
url: /
xfail: true
method: DIE
- name: non json response failure
desc: asking for json in a non json test should be failure not error
url: /
xfail: true
method: GET
request_headers:
accept: text/plain
response_json_paths:
$.data: hello
- name: json derived content type
desc: +json types should work for json paths
url: /?data=hello
method: GET
request_headers:
accept: application/vnd.complex+json
response_json_paths:
$.data[0]: hello
- name: xml derived content type
desc: +xml types should not work for json paths
xfail: true
url: /?data=hello
method: GET
request_headers:
accept: application/vnd.complex+xml
response_json_paths:
$.data[0]: hello
|