From fb697129bcb29cb9f61a2a0893d5693f9ed8ec86 Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Tue, 25 Aug 2015 16:42:54 +0000 Subject: [PATCH] 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 --- aodh/tests/api/v2/test_alarm_scenarios.py | 13 ++++++------- requirements.txt | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/aodh/tests/api/v2/test_alarm_scenarios.py b/aodh/tests/api/v2/test_alarm_scenarios.py index f7655765c..58b228ebd 100644 --- a/aodh/tests/api/v2/test_alarm_scenarios.py +++ b/aodh/tests/api/v2/test_alarm_scenarios.py @@ -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()) diff --git a/requirements.txt b/requirements.txt index 1a0693f04..4880cfd14 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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