summaryrefslogtreecommitdiff
path: root/ceilometerclient/tests/v2
diff options
context:
space:
mode:
authorEoghan Glynn <eglynn@redhat.com>2013-11-22 11:18:35 +0000
committerEoghan Glynn <eglynn@redhat.com>2013-11-22 11:40:47 +0000
commit08b476d2c9edeff7d025038467922f3d1cda6f19 (patch)
treeaf1c1c7b8ca19661e24c16988449b813945fe5a8 /ceilometerclient/tests/v2
parent936faeb33239106f49187af9424802cffd7a03dc (diff)
downloadpython-ceilometerclient-08b476d2c9edeff7d025038467922f3d1cda6f19.tar.gz
Allow alarm-threshold-update to upate generic attributes
Fixes bug 1253989 Previously, generic (i.e. non-threshold-related) alarm attributes could not be updated with the alarm-threshold-update command. An attempt to do so failed semi-silently when a non-existent dict key was referenced. Now, all alarm attributes can be updated with this command. Change-Id: Iba3f21de879fb853575dcec1730de7873eab8afd
Diffstat (limited to 'ceilometerclient/tests/v2')
-rw-r--r--ceilometerclient/tests/v2/test_shell.py37
1 files changed, 32 insertions, 5 deletions
diff --git a/ceilometerclient/tests/v2/test_shell.py b/ceilometerclient/tests/v2/test_shell.py
index 146bf2a..90d4b4d 100644
--- a/ceilometerclient/tests/v2/test_shell.py
+++ b/ceilometerclient/tests/v2/test_shell.py
@@ -172,7 +172,7 @@ class ShellAlarmCommandTest(utils.BaseTestCase):
self.args = mock.Mock()
self.args.alarm_id = self.ALARM_ID
- def _do_test_alarm_update_repeat_actions(self, repeat_actions):
+ def _do_test_alarm_update_repeat_actions(self, method, repeat_actions):
self.args.threshold = 42.0
if repeat_actions is not None:
self.args.repeat_actions = repeat_actions
@@ -183,7 +183,7 @@ class ShellAlarmCommandTest(utils.BaseTestCase):
self.cc.alarms.update.return_value = alarm[0]
try:
- ceilometer_shell.do_alarm_update(self.cc, self.args)
+ method(self.cc, self.args)
args, kwargs = self.cc.alarms.update.call_args
self.assertEqual(self.ALARM_ID, args[0])
self.assertEqual(42.0, kwargs.get('threshold'))
@@ -196,13 +196,40 @@ class ShellAlarmCommandTest(utils.BaseTestCase):
sys.stdout = orig
def test_alarm_update_repeat_actions_untouched(self):
- self._do_test_alarm_update_repeat_actions(None)
+ method = ceilometer_shell.do_alarm_update
+ self._do_test_alarm_update_repeat_actions(method, None)
def test_alarm_update_repeat_actions_set(self):
- self._do_test_alarm_update_repeat_actions(True)
+ method = ceilometer_shell.do_alarm_update
+ self._do_test_alarm_update_repeat_actions(method, True)
def test_alarm_update_repeat_actions_clear(self):
- self._do_test_alarm_update_repeat_actions(False)
+ method = ceilometer_shell.do_alarm_update
+ self._do_test_alarm_update_repeat_actions(method, False)
+
+ def test_alarm_combination_update_repeat_actions_untouched(self):
+ method = ceilometer_shell.do_alarm_combination_update
+ self._do_test_alarm_update_repeat_actions(method, None)
+
+ def test_alarm_combination_update_repeat_actions_set(self):
+ method = ceilometer_shell.do_alarm_combination_update
+ self._do_test_alarm_update_repeat_actions(method, True)
+
+ def test_alarm_combination_update_repeat_actions_clear(self):
+ method = ceilometer_shell.do_alarm_combination_update
+ self._do_test_alarm_update_repeat_actions(method, False)
+
+ def test_alarm_threshold_update_repeat_actions_untouched(self):
+ method = ceilometer_shell.do_alarm_threshold_update
+ self._do_test_alarm_update_repeat_actions(method, None)
+
+ def test_alarm_threshold_update_repeat_actions_set(self):
+ method = ceilometer_shell.do_alarm_threshold_update
+ self._do_test_alarm_update_repeat_actions(method, True)
+
+ def test_alarm_threshold_update_repeat_actions_clear(self):
+ method = ceilometer_shell.do_alarm_threshold_update
+ self._do_test_alarm_update_repeat_actions(method, False)
class ShellSampleListCommandTest(utils.BaseTestCase):