Update tests to reflect WSME 0.8.0 changes
Error messages have changed when there are invalid subfields and input handling is somewhat more strict. This patch was borrowed from a Ceilometer change: Iea8507ebc54f42786a44bfcd96246b88dd998bf0 Change-Id: I9c68690c4b0a07ad1ac9855424675a9db4625556 Co-Authored-By: Mehdi Abaakouk <sileht@redhat.com>
This commit is contained in:
parent
217723ce6c
commit
fb697129bc
@ -1411,8 +1411,6 @@ class TestAlarms(TestAlarmsBase):
|
||||
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,
|
||||
@ -1445,9 +1443,10 @@ class TestAlarms(TestAlarmsBase):
|
||||
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."""
|
||||
@ -2210,8 +2209,8 @@ class TestAlarmsRuleThreshold(TestAlarmsBase):
|
||||
}
|
||||
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())
|
||||
@ -2230,8 +2229,8 @@ class TestAlarmsRuleThreshold(TestAlarmsBase):
|
||||
}
|
||||
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())
|
||||
|
@ -33,4 +33,4 @@ stevedore>=1.5.0 # Apache-2.0
|
||||
tooz>=0.16.0 # Apache-2.0
|
||||
Werkzeug>=0.7 # BSD License
|
||||
WebOb>=1.2.3
|
||||
WSME>=0.7
|
||||
WSME>=0.8
|
||||
|
Loading…
Reference in New Issue
Block a user