def test_power_action_input_cmd_result_not_empty(self):
side_effects = [None, None, 'not_empty']
temp_arg_dict = {'host_uuid': 'fake_host_uuid'}
self.host._run_command.side_effect = side_effects
cmds = {"reboot": "host-reboot",
"startup": "host-power-on",
"shutdown": "host-shutdown"}
fake_action = 'reboot' # 'statup' and 'shutdown' should be same
expected_cmd_arg_list = [call(["xe", "host-disable", "uuid=%s"
% 'fake_host_uuid']),
call(["xe", "vm-shutdown", "--multiple",
"resident-on=%s" % 'fake_host_uuid']),
call(["xe", cmds[fake_action], "uuid=%s" %
'fake_host_uuid'])]
self.assertRaises(self.pluginlib.PluginError,
self.host._power_action,
fake_action, temp_arg_dict)
self.assertEqual(self.host._run_command.call_args_list,
expected_cmd_arg_list)
评论列表
文章目录