aodh/ceilometer/tests/gabbi/gabbits/resources-fixtured.yaml
Chris Dent 4647acca8e Add gabbi tests for resources
These test for appopriate HTTP behavior. Two different files are
used: one without any resources established by fixture and one which
uses the SampleDataFixture to make sure there is one resource.

Future gabbi tests for resources should explore authorization
handling (RBAC) and more complex query scenarios (with larger data
sets).

Change-Id: I95b4ed684f663912c29da3d48102631f4d0dd4df
2015-03-17 14:07:57 +00:00

58 lines
1.7 KiB
YAML

#
# Explore and cover resources API with gabbi tests when there are a
# small number of pre-existing resources
#
fixtures:
- ConfigFixture
- SampleDataFixture
tests:
- name: list all resources
url: /v2/resources
response_json_paths:
$[0].user_id: farmerjon
$[0].links[1].rel: livestock
- name: get one resource
desc: get a resource via the links in the first resource listed above
url: $RESPONSE['$[0].links[0].href']
response_json_paths:
$.resource_id: $RESPONSE['$[0].resource_id']
- name: list resources limit user_id
url: /v2/resources?q.field=user_id&q.value=farmerjon
response_json_paths:
$[0].user_id: farmerjon
$[0].links[1].rel: livestock
- name: list resources limit metadata
url: /v2/resources?q.field=metadata.breed&q.value=sheep
response_json_paths:
$[0].user_id: farmerjon
$[0].links[1].rel: livestock
- name: list resources limit metadata no match
url: /v2/resources?q.field=metadata.breed&q.value=llamma
response_strings:
- "[]"
- name: fail to get one resource
url: /v2/resources/nosirnothere
status: 404
- name: list resource meter links present
url: /v2/resources?meter_links=1
response_json_paths:
$[0].links[0].rel: self
$[0].links[1].rel: livestock
$[0].links[-1].rel: livestock
- name: list resource meter links not present
url: /v2/resources?meter_links=0
desc: there is only one links entry when meter_links is 0
response_json_paths:
$[0].links[0].rel: self
$[0].links[-1].rel: self