Don't assume alarms are returned in insert order

The previous implentation of the tests assure than the db backends
return the alarms into the insert order. This is false for mysql.

The patch rewritte the tests to make it compatible to mysql

Change-Id: I146de0d8cef78b6c734bc6742238b939422645b9
This commit is contained in:
Mehdi Abaakouk 2013-12-19 15:07:55 +01:00
parent 9cf440cc8e
commit 49b9a547ff

View File

@ -2012,9 +2012,10 @@ class AlarmTest(AlarmTestBase,
self.add_some_alarms()
alarms = list(self.conn.get_alarms())
self.assertEqual(len(alarms), 3)
self.assertEqual(alarms[0].rule['meter_name'], 'test.one')
self.assertEqual(alarms[1].rule['meter_name'], 'test.fourty')
self.assertEqual(alarms[2].rule['meter_name'], 'test.five')
meter_names = sorted([a.rule['meter_name'] for a in alarms])
self.assertEqual(meter_names,
['test.five', 'test.fourty', 'test.one'])
def test_update(self):
self.add_some_alarms()