Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ceilometer API test for Alarms

hello,

I am trying to add the alarm functionality to the ceilometerclient wrapper in horizon. here . I have added the method to get alarm list, now I am trying to write a test case for it here

my test method looks like this.

def test_alarm_list(self):
    alarms = self.alarms.list()
    ceilometerclient = self.stub_ceilometerclient()
    ceilometerclient.alarms = self.mox.CreateMockAnything()
    ceilometerclient.alarms.list().AndReturn(alarms)
    self.mox.ReplayAll()
    ret_list = api.ceilometer.alarm_list(self.request,q=[])
    for c in ret_list:
        # assert condition for alarm check

I get an error saying AttributeError: 'CeilometerApiTests' object has no attribute 'alarms' I can see the similar test cases for samples and meters in CeilometerApiTests, so my question is

  1. where should I add the alarms parameter ?
  2. what went wrong here ?