WSME 0.5b5 breaking unit tests
- fix tests to accept new (accurate) response codes - wsme doesn't like us sending gettextutils.Message values. pass in a regular string Change-Id: Ie9e05edfd542ba1fe8c6fdbeed2daab12cf30caf Fixes:Bug #1227264
This commit is contained in:
parent
5bf2072ac7
commit
3a480cb424
@ -197,17 +197,17 @@ class Query(_Base):
|
||||
msg = _('Failed to convert the metadata value %(value)s'
|
||||
' to the expected data type %(type)s.') % \
|
||||
{'value': self.value, 'type': self.type}
|
||||
raise wsme.exc.ClientSideError(msg)
|
||||
raise wsme.exc.ClientSideError(unicode(msg))
|
||||
except TypeError:
|
||||
msg = _('The data type %s is not supported. The supported'
|
||||
' data type list is: integer, float, boolean and'
|
||||
' string.') % (self.type)
|
||||
raise wsme.exc.ClientSideError(msg)
|
||||
raise wsme.exc.ClientSideError(unicode(msg))
|
||||
except Exception:
|
||||
msg = _('Unexpected exception converting %(value)s to'
|
||||
' the expected data type %(type)s.') % \
|
||||
{'value': self.value, 'type': self.type}
|
||||
raise wsme.exc.ClientSideError(msg)
|
||||
raise wsme.exc.ClientSideError(unicode(msg))
|
||||
return converted_value
|
||||
|
||||
|
||||
@ -672,7 +672,7 @@ class MeterController(rest.RestController):
|
||||
if period and period < 0:
|
||||
error = _("Period must be positive.")
|
||||
pecan.response.translatable_error = error
|
||||
raise wsme.exc.ClientSideError(error)
|
||||
raise wsme.exc.ClientSideError(unicode(error))
|
||||
|
||||
kwargs = _query_to_kwargs(q, storage.SampleFilter.__init__)
|
||||
kwargs['meter'] = self._id
|
||||
@ -834,7 +834,7 @@ class ResourcesController(rest.RestController):
|
||||
pecan.response.translatable_error = error
|
||||
raise wsme.exc.InvalidInput("resource_id",
|
||||
resource_id,
|
||||
error)
|
||||
unicode(error))
|
||||
return Resource.from_db_and_links(resources[0],
|
||||
self._resource_links(resource_id))
|
||||
|
||||
@ -1011,7 +1011,7 @@ class AlarmController(rest.RestController):
|
||||
if len(alarms) < 1:
|
||||
error = _("Unknown alarm")
|
||||
pecan.response.translatable_error = error
|
||||
raise wsme.exc.ClientSideError(error)
|
||||
raise wsme.exc.ClientSideError(unicode(error))
|
||||
return alarms[0]
|
||||
|
||||
def _record_change(self, data, now, on_behalf_of=None, type=None):
|
||||
@ -1141,7 +1141,7 @@ class AlarmsController(rest.RestController):
|
||||
if len(alarms) > 0:
|
||||
error = _("Alarm with that name exists")
|
||||
pecan.response.translatable_error = error
|
||||
raise wsme.exc.ClientSideError(error)
|
||||
raise wsme.exc.ClientSideError(unicode(error))
|
||||
|
||||
try:
|
||||
kwargs = data.as_dict(storage.models.Alarm)
|
||||
@ -1150,7 +1150,7 @@ class AlarmsController(rest.RestController):
|
||||
LOG.exception(ex)
|
||||
error = _("Alarm incorrect")
|
||||
pecan.response.translatable_error = error
|
||||
raise wsme.exc.ClientSideError(error)
|
||||
raise wsme.exc.ClientSideError(unicode(error))
|
||||
|
||||
alarm = conn.create_alarm(alarm_in)
|
||||
self._record_creation(conn, change, alarm.alarm_id, now)
|
||||
|
@ -124,7 +124,7 @@ class TestAlarms(FunctionalTest,
|
||||
'statistic': 'avg',
|
||||
'repeat_actions': True,
|
||||
}
|
||||
self.post_json('/alarms', params=json, status=200,
|
||||
self.post_json('/alarms', params=json, status=201,
|
||||
headers=self.auth_headers)
|
||||
alarms = list(self.conn.get_alarms())
|
||||
self.assertEqual(4, len(alarms))
|
||||
@ -180,7 +180,7 @@ class TestAlarms(FunctionalTest,
|
||||
|
||||
self.delete('/alarms/%s' % data[0]['alarm_id'],
|
||||
headers=self.auth_headers,
|
||||
status=200)
|
||||
status=204)
|
||||
alarms = list(self.conn.get_alarms())
|
||||
self.assertEqual(2, len(alarms))
|
||||
|
||||
@ -210,7 +210,7 @@ class TestAlarms(FunctionalTest,
|
||||
def _delete_alarm(self, alarm, auth_headers=None):
|
||||
self.delete('/alarms/%s' % alarm['alarm_id'],
|
||||
headers=auth_headers or self.auth_headers,
|
||||
status=200)
|
||||
status=204)
|
||||
|
||||
def _assert_is_subset(self, expected, actual):
|
||||
for k, v in expected.iteritems():
|
||||
@ -242,7 +242,7 @@ class TestAlarms(FunctionalTest,
|
||||
comparison_operator='le',
|
||||
threshold=42.0,
|
||||
statistic='max')
|
||||
self.post_json('/alarms', params=new_alarm, status=200,
|
||||
self.post_json('/alarms', params=new_alarm, status=201,
|
||||
headers=self.auth_headers)
|
||||
alarm = self.get_json('/alarms')[3]
|
||||
history = self._get_alarm_history(alarm)
|
||||
@ -304,7 +304,7 @@ class TestAlarms(FunctionalTest,
|
||||
comparison_operator='le',
|
||||
threshold=42.0,
|
||||
statistic='max')
|
||||
self.post_json('/alarms', params=new_alarm, status=200,
|
||||
self.post_json('/alarms', params=new_alarm, status=201,
|
||||
headers=member_auth)
|
||||
alarm = self.get_json('/alarms', headers=member_auth)[0]
|
||||
|
||||
@ -366,7 +366,7 @@ class TestAlarms(FunctionalTest,
|
||||
alarm = self._get_alarm('a')
|
||||
self.delete('/alarms/%s' % alarm['alarm_id'],
|
||||
headers=self.auth_headers,
|
||||
status=200)
|
||||
status=204)
|
||||
history = self._get_alarm_history(alarm)
|
||||
self.assertEqual(2, len(history))
|
||||
self._assert_is_subset(dict(alarm_id=alarm['alarm_id'],
|
||||
|
Loading…
Reference in New Issue
Block a user