def test_power_off_error(self):
        mock_pm = MagicMock(powermanager)
        mock_pm._modify_deployment.return_value = 404, 'test'
        mock_pm._mvs_seen = {}

        self.assertEquals(powermanager._power_off(mock_pm, ['task2']), False)
        self.assertIn(
            "ERROR deleting nodes: ['task2']: test", self.log.getvalue())
    def test_power_off_exception(self):
        mock_pm = MagicMock(powermanager)
        mock_pm._modify_deployment.side_effect = Exception()
        mock_pm._mvs_seen = {}

        self.assertEquals(powermanager._power_off(mock_pm, ['task2']), False)
        self.assertIn(
            "Error powering off nodes ['task2']", self.log.getvalue())
    def test_power_off(self):
        mock_pm = MagicMock(powermanager)
        mock_pm._modify_deployment.return_value = 200, 'test'
        mock_pm._mvs_seen = {}

        self.assertEquals(powermanager._power_off(mock_pm, ['task2']), True)
        self.assertIn(
            "Nodes ['task2'] successfully deleted", self.log.getvalue())