From 6a6a544dc0078e7a7a214d23d5d05cb08c0c7288 Mon Sep 17 00:00:00 2001 From: Fengqian Gao Date: Thu, 5 Sep 2013 19:11:54 +0800 Subject: [PATCH] Change test case get_alarm_history_on_create New added alarm maybe not the last item of get_alarms, especially after pagination query be supported. Change-Id: Ib0475cda9c4125c6d84ca7a66428fa9300364d06 --- tests/api/v2/test_alarm_scenarios.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/api/v2/test_alarm_scenarios.py b/tests/api/v2/test_alarm_scenarios.py index 0b9dedcea..f6aa255c5 100644 --- a/tests/api/v2/test_alarm_scenarios.py +++ b/tests/api/v2/test_alarm_scenarios.py @@ -1013,7 +1013,14 @@ class TestAlarms(FunctionalTest, } self.post_json('/alarms', params=new_alarm, status=201, headers=self.auth_headers) - alarm = self.get_json('/alarms')[4] + + alarms = self.get_json('/alarms', + q=[{'field': 'name', + 'value': 'new_alarm', + }]) + self.assertEqual(1, len(alarms)) + alarm = alarms[0] + history = self._get_alarm_history(alarm) self.assertEqual(1, len(history)) self._assert_is_subset(dict(alarm_id=alarm['alarm_id'],