From 9fe6b6eeae70a6bdf5454533ab175323928adac6 Mon Sep 17 00:00:00 2001 From: Fengqian Gao Date: Fri, 9 Aug 2013 23:19:54 +0800 Subject: [PATCH] Change test_post_alarm case in test_alarm_scenarios It is not reasonable to assert that the new added object will be the last one when call get_alarms, especially after default sort direction is added. Change-Id: Icd81aca5cd15e5ec34f081fe29fbad49dcccc45c --- tests/api/v2/test_alarm_scenarios.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/api/v2/test_alarm_scenarios.py b/tests/api/v2/test_alarm_scenarios.py index c0be10c5f..26e411d65 100644 --- a/tests/api/v2/test_alarm_scenarios.py +++ b/tests/api/v2/test_alarm_scenarios.py @@ -123,7 +123,12 @@ class TestAlarms(FunctionalTest, headers=self.auth_headers) alarms = list(self.conn.get_alarms()) self.assertEquals(4, len(alarms)) - self.assertEquals(alarms[3].repeat_actions, True) + for alarm in alarms: + if alarm.name == 'added_alarm': + self.assertEqual(alarm.repeat_actions, True) + break + else: + self.fail("Alarm not found") def test_put_alarm(self): json = {