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

View File

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

View File

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

View File

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

View File

@ -64,7 +64,7 @@ test =
tempest>=11.0.0 # Apache-2.0 tempest>=11.0.0 # Apache-2.0
testrepository>=0.0.18 testrepository>=0.0.18
testresources>=0.2.4 # Apache-2.0/BSD 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 # Provides subunit-trace
os-testr os-testr
python-subunit>=0.0.18 python-subunit>=0.0.18