modernise gabbi usage

as our borderline millenial hero progressed through the land of dried
bread, he found himself at the gates of hell. the flames of unreadable
wsme code overwhelmed him. as a lazy protagonist, he decided to ignore
wsme and just deal with cleaning up gabbi. this work came a bit easier
as it was quite similar to his work in panko and thus, he took gabbi
v1.7, and drop some of the redundancy.

Change-Id: I19dfb39ea8b9a4fc4063e32ce19b62d8ce74f939
This commit is contained in:
gord chung 2017-01-16 20:54:45 +00:00
parent 87ec850a29
commit 600d6ee0a9
5 changed files with 28 additions and 52 deletions

View File

@ -5,15 +5,13 @@ defaults:
tests:
- name: list alarms none
desc: Lists alarms, none yet exist
url: /v2/alarms
method: GET
GET: /v2/alarms
response_strings:
- "[]"
- name: try to PUT an alarm
desc: what does PUT do
url: /v2/alarms
method: PUT
PUT: /v2/alarms
request_headers:
content-type: application/json
data:
@ -28,8 +26,7 @@ tests:
- name: createAlarm
desc: Creates an alarm.
url: /v2/alarms
method: POST
POST: /v2/alarms
request_headers:
content-type: application/json
data:
@ -49,8 +46,7 @@ tests:
- name: showAlarm
desc: Shows information for a specified alarm.
url: /v2/alarms/$RESPONSE['$.alarm_id']
method: GET
GET: /v2/alarms/$RESPONSE['$.alarm_id']
response_json_paths:
$.severity: low
$.alarm_id: $RESPONSE['$.alarm_id']
@ -61,8 +57,7 @@ tests:
- name: updateAlarm
desc: Updates a specified alarm.
url: /v2/alarms/$RESPONSE['$.alarm_id']
method: PUT
PUT: /v2/alarms/$RESPONSE['$.alarm_id']
request_headers:
content-type: application/json
data:
@ -81,18 +76,16 @@ tests:
- name: showAlarmHistory
desc: Assembles the history for a specified alarm.
url: /v2/alarms/$RESPONSE['$.alarm_id']/history?q.field=type&q.op=eq&q.value=rule%20change
method: GET
GET: /v2/alarms/$RESPONSE['$.alarm_id']/history?q.field=type&q.op=eq&q.value=rule%20change
response_json_paths:
$[0].type: rule change
- name: updateAlarmState
desc: Sets the state of a specified alarm.
url: /v2/alarms/$RESPONSE['$[0].alarm_id']/state
PUT: /v2/alarms/$RESPONSE['$[0].alarm_id']/state
request_headers:
content-type: application/json
data: '"alarm"'
method: PUT
# TODO(chdent): really? Of what possible use is this?
response_json_paths:
$: alarm
@ -100,15 +93,13 @@ tests:
# Get a list of alarms so we can extract an id for the next test
- name: list alarms for data
desc: Lists alarms, only one
url: /v2/alarms
method: GET
GET: /v2/alarms
response_json_paths:
$[0].name: added_alarm_defaults
- name: showAlarmState
desc: Gets the state of a specified alarm.
url: /v2/alarms/$RESPONSE['$[0].alarm_id']/state
method: GET
GET: /v2/alarms/$RESPONSE['$[0].alarm_id']/state
response_headers:
content-type: application/json; charset=UTF-8
response_json_paths:
@ -116,20 +107,17 @@ tests:
- name: list alarms one
desc: Lists alarms, only one
url: /v2/alarms
method: GET
GET: /v2/alarms
response_json_paths:
$[0].name: added_alarm_defaults
- name: deleteAlarm
desc: Deletes a specified alarm.
url: /v2/alarms/$RESPONSE['$[0].alarm_id']
method: DELETE
DELETE: /v2/alarms/$RESPONSE['$[0].alarm_id']
status: 204
- name: list alarms none end
desc: Lists alarms, none now exist
url: /v2/alarms
method: GET
GET: /v2/alarms
response_strings:
- "[]"

View File

@ -6,15 +6,13 @@ fixtures:
tests:
- name: list alarms none
desc: Lists alarms, none yet exist
url: /v2/alarms
method: GET
GET: /v2/alarms
response_strings:
- "[]"
- name: try to PUT an alarm
desc: what does PUT do
url: /v2/alarms
method: PUT
PUT: /v2/alarms
request_headers:
content-type: application/json
data:
@ -29,8 +27,7 @@ tests:
- name: createAlarm
desc: Creates an alarm.
url: /v2/alarms
method: POST
POST: /v2/alarms
request_headers:
content-type: application/json
data:
@ -51,8 +48,7 @@ tests:
- name: showAlarm
desc: Shows information for a specified alarm.
url: /v2/alarms/$RESPONSE['$.alarm_id']
method: GET
GET: /v2/alarms/$RESPONSE['$.alarm_id']
response_json_paths:
$.severity: low
$.alarm_id: $RESPONSE['$.alarm_id']
@ -63,8 +59,7 @@ tests:
- name: updateAlarm
desc: Updates a specified alarm.
url: /v2/alarms/$RESPONSE['$.alarm_id']
method: PUT
PUT: /v2/alarms/$RESPONSE['$.alarm_id']
request_headers:
content-type: application/json
data:
@ -83,18 +78,16 @@ tests:
- name: showAlarmHistory
desc: Assembles the history for a specified alarm.
url: /v2/alarms/$RESPONSE['$.alarm_id']/history?q.field=type&q.op=eq&q.value=rule%20change
method: GET
GET: /v2/alarms/$RESPONSE['$.alarm_id']/history?q.field=type&q.op=eq&q.value=rule%20change
response_json_paths:
$[0].type: rule change
- name: updateAlarmState
desc: Sets the state of a specified alarm.
url: /v2/alarms/$RESPONSE['$[0].alarm_id']/state
PUT: /v2/alarms/$RESPONSE['$[0].alarm_id']/state
request_headers:
content-type: application/json
data: '"alarm"'
method: PUT
# TODO(chdent): really? Of what possible use is this?
response_json_paths:
$: alarm
@ -102,15 +95,13 @@ tests:
# Get a list of alarms so we can extract an id for the next test
- name: list alarms for data
desc: Lists alarms, only one
url: /v2/alarms
method: GET
GET: /v2/alarms
response_json_paths:
$[0].name: added_alarm_defaults
- name: showAlarmState
desc: Gets the state of a specified alarm.
url: /v2/alarms/$RESPONSE['$[0].alarm_id']/state
method: GET
GET: /v2/alarms/$RESPONSE['$[0].alarm_id']/state
response_headers:
content-type: application/json
response_json_paths:
@ -118,20 +109,17 @@ tests:
- name: list alarms one
desc: Lists alarms, only one
url: /v2/alarms
method: GET
GET: /v2/alarms
response_json_paths:
$[0].name: added_alarm_defaults
- name: deleteAlarm
desc: Deletes a specified alarm.
url: /v2/alarms/$RESPONSE['$[0].alarm_id']
method: DELETE
DELETE: /v2/alarms/$RESPONSE['$[0].alarm_id']
status: 204
- name: list alarms none end
desc: Lists alarms, none now exist
url: /v2/alarms
method: GET
GET: /v2/alarms
response_strings:
- "[]"

View File

@ -8,7 +8,7 @@ tests:
# Root gives us some information on where to go from here.
- name: quick root check
url: /
GET: /
response_headers:
content-type: application/json
response_strings:
@ -20,5 +20,5 @@ tests:
# NOTE(chdent): Ideally since / has a links ref to /v2, /v2 ought not 404!
- name: v2 visit
desc: this demonstrates a bug in the info in /
url: $RESPONSE['versions.values.[0].links.[0].href']
GET: $RESPONSE['versions.values.[0].links.[0].href']
status: 404

View File

@ -7,6 +7,6 @@ fixtures:
tests:
- name: get capabilities
url: /v2/capabilities
GET: /v2/capabilities
response_json_paths:
$.alarm_storage.['storage:production_ready']: true

View File

@ -64,7 +64,7 @@ test =
tempest>=11.0.0 # Apache-2.0
testrepository>=0.0.18
testresources>=0.2.4 # Apache-2.0/BSD
gabbi>=0.12.0 # Apache-2.0
gabbi>=1.7.0 # Apache-2.0
# Provides subunit-trace
os-testr
python-subunit>=0.0.18