def test_wait_for_power_state_false(self, mock_with_timeout):
        desired_power_state = mock.sentinel.power_state
        mock_with_timeout.side_effect = etimeout.Timeout()

        response = vmutils.wait_for_power_state(
            self._instance, desired_power_state,
            constants.SHUTDOWN_RETRY_INTERVAL)

        self.assertFalse(response)
Esempio n. 2
0
    def test_wait_for_power_state_false(self, mock_with_timeout):
        desired_power_state = mock.sentinel.power_state
        mock_with_timeout.side_effect = etimeout.Timeout()

        response = vmutils.wait_for_power_state(
            self._instance, desired_power_state,
            constants.SHUTDOWN_RETRY_INTERVAL)

        self.assertFalse(response)
    def test_wait_for_power_state_true(self, mock_get_power_state):
        desired_power_state = mock.sentinel.power_state
        mock_get_power_state.return_value = desired_power_state

        response = vmutils.wait_for_power_state(
            self._instance, desired_power_state,
            constants.SHUTDOWN_RETRY_INTERVAL)

        mock_get_power_state.assert_called_with(self._instance)
        self.assertTrue(response)
Esempio n. 4
0
    def test_wait_for_power_state_true(self, mock_get_power_state):
        desired_power_state = mock.sentinel.power_state
        mock_get_power_state.return_value = desired_power_state

        response = vmutils.wait_for_power_state(
            self._instance, desired_power_state,
            constants.SHUTDOWN_RETRY_INTERVAL)

        mock_get_power_state.assert_called_with(self._instance)
        self.assertTrue(response)