summaryrefslogtreecommitdiff
path: root/heatclient/tests
diff options
context:
space:
mode:
authorrabi <ramishra@redhat.com>2017-08-24 12:10:41 +0530
committerrabi <ramishra@redhat.com>2017-11-08 08:14:48 +0530
commitf0d3d9f1f9380f632e5fd2a66941eb58f79c797b (patch)
tree41102d60968137a119f914327daecef9894c8934 /heatclient/tests
parent187fc54249982d2f7213c750d98c6602a08b758b (diff)
downloadpython-heatclient-f0d3d9f1f9380f632e5fd2a66941eb58f79c797b.tar.gz
Allow cancelling create_in_progress stacks with --no-rollback
Change-Id: Ib107c82f341f4d271859ca7681d65f7ce4c5d0b1 Related-Bug: #1709041
Diffstat (limited to 'heatclient/tests')
-rw-r--r--heatclient/tests/unit/osc/v1/test_stack.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/heatclient/tests/unit/osc/v1/test_stack.py b/heatclient/tests/unit/osc/v1/test_stack.py
index ebe5329..04c9da4 100644
--- a/heatclient/tests/unit/osc/v1/test_stack.py
+++ b/heatclient/tests/unit/osc/v1/test_stack.py
@@ -1221,18 +1221,21 @@ class TestStackCancel(_TestStackCheckBase, TestStack):
def test_stack_cancel(self):
self._test_stack_action(2)
- def test_stack_cancel_no_rollback(self):
+ def _test_stack_cancel_no_rollback(self, call_count):
self.action = self.mock_client.actions.cancel_without_rollback
arglist = ['my_stack', '--no-rollback']
parsed_args = self.check_parser(self.cmd, arglist, [])
columns, rows = self.cmd.take_action(parsed_args)
self.action.assert_called_once_with('my_stack')
self.mock_client.stacks.get.assert_called_with('my_stack')
- self.assertEqual(2,
+ self.assertEqual(call_count,
self.mock_client.stacks.get.call_count)
self.assertEqual(self.columns, columns)
self.assertEqual(1, len(rows))
+ def test_stack_cancel_no_rollback(self):
+ self._test_stack_cancel_no_rollback(2)
+
def test_stack_cancel_multi(self):
self._test_stack_action_multi(4)
@@ -1246,6 +1249,7 @@ class TestStackCancel(_TestStackCheckBase, TestStack):
self._test_stack_action_exception()
def test_stack_cancel_unsupported_state(self):
+ self.stack.stack_status = "CREATE_COMPLETE"
self.mock_client.stacks.get.return_value = self.stack
error = self.assertRaises(exc.CommandError,
self._test_stack_action,
@@ -1254,6 +1258,17 @@ class TestStackCancel(_TestStackCheckBase, TestStack):
'not in cancelable state',
str(error))
+ def test_stack_cancel_create_in_progress(self):
+ self.stack.stack_status = "CREATE_IN_PROGRESS"
+ self.mock_client.stacks.get.return_value = self.stack
+ error = self.assertRaises(exc.CommandError,
+ self._test_stack_action,
+ 2)
+ self.assertEqual('Stack my_stack with status \'create_in_progress\' '
+ 'not in cancelable state',
+ str(error))
+ self._test_stack_cancel_no_rollback(3)
+
class TestStackCheck(_TestStackCheckBase, TestStack):