Update tests to reflect WSME 0.8 fixes

All these bugs are now fixed in wsme 0.8.0

Closes-bug: #1424642
Closes-bug: #1423634
Closes-bug: #1419110
Closes-bug: #1428185
Closes-bug: #1428628
Closes-bug: #1428658
Closes-bug: #1428624

Change-Id: Iea8507ebc54f42786a44bfcd96246b88dd998bf0
This commit is contained in:
Mehdi Abaakouk 2015-08-03 14:41:42 +02:00 committed by Chris Dent
parent 7d4fa41b16
commit d7428b7c38
4 changed files with 14 additions and 25 deletions

View File

@ -859,8 +859,8 @@ class TestAlarms(v2.FunctionalTest,
}
resp = self.post_json('/alarms', params=json, expect_errors=True,
status=400, headers=self.auth_headers)
expected_error_message = ("Invalid input for field/attribute field. "
"Value: 'None'. Mandatory field missing.")
expected_error_message = ("Unknown attribute for argument "
"data.threshold_rule.query: q.field")
fault_string = resp.json['error_message']['faultstring']
self.assertEqual(expected_error_message, fault_string)
alarms = list(self.alarm_conn.get_alarms())
@ -879,8 +879,8 @@ class TestAlarms(v2.FunctionalTest,
}
resp = self.post_json('/alarms', params=json, expect_errors=True,
status=400, headers=self.auth_headers)
expected_error_message = ("Invalid input for field/attribute value. "
"Value: 'None'. Mandatory field missing.")
expected_error_message = ("Unknown attribute for argument "
"data.threshold_rule.query: q.value")
fault_string = resp.json['error_message']['faultstring']
self.assertEqual(expected_error_message, fault_string)
alarms = list(self.alarm_conn.get_alarms())
@ -1946,8 +1946,6 @@ class TestAlarms(v2.FunctionalTest,
self._verify_alarm(json, alarm)
def test_put_alarm_wrong_field(self):
# Note: wsme will ignore unknown fields so will just not appear in
# the Alarm.
json = {
'this_can_not_be_correct': 'ha',
'enabled': False,
@ -1980,9 +1978,10 @@ class TestAlarms(v2.FunctionalTest,
alarm_id = data[0]['alarm_id']
resp = self.put_json('/alarms/%s' % alarm_id,
expect_errors=True,
params=json,
headers=self.auth_headers)
self.assertEqual(200, resp.status_code)
self.assertEqual(400, resp.status_code)
def test_put_alarm_with_existing_name(self):
"""Test that update a threshold alarm with an existing name."""

View File

@ -79,7 +79,6 @@ tests:
# this attempts to query the events with the wrong data query syntax missing the
# q object but supplying the field list and a bad field name and expects a 400
- name: get events that match bad query via request data malformed list
desc: https://bugs.launchpad.net/ceilometer/+bug/1423634
url: /v2/events
request_headers:
content-type: application/json; charset=UTF-8
@ -88,21 +87,18 @@ tests:
op: eq
type: string
value: cookies_chocolate.chip
xfail: True
status: 400
# this attempts to query the events with the wrong data query syntax missing the
# q object but supplying the field list along with a bad content-type. Should
# return a 400
- name: get events that match bad query via request data wrong type
desc: https://bugs.launchpad.net/ceilometer/+bug/1423634 and https://bugs.launchpad.net/ceilometer/+bug/1424642
url: /v2/events
request_headers:
content-type: text/plain
data:
"field: bad_field op: eq type: string value: cookies_chocolate.chip xfail: True"
xfail: True
status: 400
status: 415
# Get a single event by message_id no data is present so should return a 404
- name: get a single event

View File

@ -91,7 +91,6 @@ tests:
# this attempts to query the events with the wrong data query syntax missing the
# q object but supplying the field list and a bad field name and expects a 400
- name: get events that match bad query via data list
desc: https://bugs.launchpad.net/ceilometer/+bug/1423634
url: /v2/events
request_headers:
content-type: application/json; charset=UTF-8
@ -100,7 +99,6 @@ tests:
op: eq
type: string
value: cookies_chocolate.chip
xfail: True
status: 400
# Get a single event by message_id should return an event

View File

@ -76,18 +76,14 @@ tests:
$.error_message.faultstring: "Samples should be included in request body"
- name: post meter bad content-type
desc: https://bugs.launchpad.net/wsme/+bug/1419110
xfail: true
url: /v2/meters/apples?direct=True
method: POST
request_headers:
content-type: text/plain
data: hello
status: 400
status: 415
- name: post bad samples to meter
desc: https://bugs.launchpad.net/ceilometer/+bug/1428185
xfail: true
url: /v2/meters/apples?direct=True
method: POST
request_headers:
@ -225,8 +221,6 @@ tests:
# Explore posting samples with less than perfect data.
- name: post counter with bad timestamp
desc: https://bugs.launchpad.net/wsme/+bug/1428624
xfail: true
url: /v2/meters/apples?direct=True
method: POST
request_headers:
@ -238,6 +232,9 @@ tests:
counter_volume: 3
resource_id: aa9431c1-8d69-4ad3-803a-8d4a6b89fdaa
timestamp: "2013-01-bad 23:23:20"
status: 400
response_strings:
- 'Invalid input for field/attribute samples'
- name: post counter with good timestamp
url: /v2/meters/apples?direct=True
@ -254,8 +251,6 @@ tests:
timestamp: "2013-01-01 23:23:20"
- name: post counter with wrong metadata
desc: https://bugs.launchpad.net/ceilometer/+bug/1428628
xfail: true
url: /v2/meters/apples?direct=True
method: POST
request_headers:
@ -268,6 +263,9 @@ tests:
resource_id: aa9431c1-8d69-4ad3-803a-8d4a6b89fdaa
timestamp: "2013-01-01 23:23:20"
resource_metadata: "a string"
status: 400
response_strings:
- "Invalid input for field/attribute samples"
- name: post counter with empty metadata
url: /v2/meters/apples?direct=True
@ -347,8 +345,6 @@ tests:
- "[]"
- name: get sample statistics select aggregate bad format
desc: https://bugs.launchpad.net/wsme/+bug/1428658
xfail: true
url: /v2/meters/apples/statistics?aggregate=max
status: 400