def test_alarm_list(self):
        d = ceilometer_v2.CeilometerClient(self.conn_params)
        d.alarm_list()
        self.mock_conn.telemetry.alarms.assert_called_once_with()

        self.mock_conn.telemetry.alarms.reset_mock()

        d.alarm_list(name='fakename')
        self.mock_conn.telemetry.alarms.assert_called_once_with(
            name='fakename')
    def test_alarm_find(self):
        d = ceilometer_v2.CeilometerClient(self.conn_params)
        d.alarm_find('fakeid', True)
        self.mock_conn.telemetry.find_alarm.assert_called_once_with(
            'fakeid', True)

        self.mock_conn.telemetry.find_alarm.reset_mock()

        d.alarm_find('fakeid', False)
        self.mock_conn.telemetry.find_alarm.assert_called_once_with(
            'fakeid', False)

        self.mock_conn.telemetry.find_alarm.reset_mock()

        d.alarm_find('fakeid')
        self.mock_conn.telemetry.find_alarm.assert_called_once_with(
            'fakeid', True)
    def test_alarm_delete(self):
        d = ceilometer_v2.CeilometerClient(self.conn_params)
        d.alarm_delete('foo', True)
        self.mock_conn.telemetry.delete_alarm.assert_called_once_with(
            'foo', True)

        self.mock_conn.telemetry.delete_alarm.reset_mock()

        d.alarm_delete('foo', False)
        self.mock_conn.telemetry.delete_alarm.assert_called_once_with(
            'foo', False)

        self.mock_conn.telemetry.delete_alarm.reset_mock()

        d.alarm_delete('foo')
        self.mock_conn.telemetry.delete_alarm.assert_called_once_with(
            'foo', True)
 def test_alarm_update(self):
     d = ceilometer_v2.CeilometerClient(self.conn_params)
     attrs = {'enabled': False}
     d.alarm_update('fakeid', **attrs)
     self.mock_conn.telemetry.update_alarm.assert_called_once_with(
         'fakeid', **attrs)
 def test_alarm_get(self):
     d = ceilometer_v2.CeilometerClient(self.conn_params)
     d.alarm_get('fakeid')
     self.mock_conn.telemetry.get_alarm.assert_called_once_with('fakeid')
 def test_alarm_create(self):
     d = ceilometer_v2.CeilometerClient(self.conn_params)
     d.alarm_create(name='test_alarm')
     self.mock_conn.telemetry.create_alarm.assert_called_once_with(
         name='test_alarm')
 def test_init(self):
     d = ceilometer_v2.CeilometerClient(self.conn_params)
     self.mock_create.assert_called_once_with(self.conn_params)
     self.assertEqual(self.mock_conn, d.conn)
 def test_sample_create(self):
     d = ceilometer_v2.CeilometerClient(self.conn_params)
     attrs = {'foo': 'bar'}
     d.sample_create(**attrs)
     self.mock_conn.telemetry.create_sample.assert_called_once_with(
         foo='bar')