diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-02-26 10:04:43 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-02-26 10:04:43 +0000 |
commit | 0a7f8bf1d6c802db673c0956f30a41b29626196f (patch) | |
tree | 2020fb55bccb93a109ab224fd37e47adf065b249 /heatclient/tests/unit/osc/v1/test_stack.py | |
parent | 04756b0aea0ffbbd45c1a37e6b1be3cd3f463324 (diff) | |
parent | 7f6b769aeb7ee1ff081b61b18b22fd920a1f6c35 (diff) | |
download | python-heatclient-0a7f8bf1d6c802db673c0956f30a41b29626196f.tar.gz |
Merge "Use poll_for_events for "openstack stack adopt""
Diffstat (limited to 'heatclient/tests/unit/osc/v1/test_stack.py')
-rw-r--r-- | heatclient/tests/unit/osc/v1/test_stack.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/heatclient/tests/unit/osc/v1/test_stack.py b/heatclient/tests/unit/osc/v1/test_stack.py index 113c6ef..f285f56 100644 --- a/heatclient/tests/unit/osc/v1/test_stack.py +++ b/heatclient/tests/unit/osc/v1/test_stack.py @@ -684,10 +684,13 @@ class TestStackAdopt(TestStack): self.stack_client.create.assert_called_with(**kwargs) - def test_stack_adopt_wait(self): + @mock.patch('heatclient.common.event_utils.poll_for_events', + return_value=('ADOPT_COMPLETE', + 'Stack my_stack ADOPT_COMPLETE')) + def test_stack_adopt_wait(self, mock_poll): arglist = ['my_stack', '--adopt-file', self.adopt_file, '--wait'] self.stack_client.get = mock.MagicMock(return_value=( - stacks.Stack(None, {'stack_status': 'CREATE_COMPLETE'}))) + stacks.Stack(None, {'stack_status': 'ADOPT_COMPLETE'}))) parsed_args = self.check_parser(self.cmd, arglist, []) self.cmd.take_action(parsed_args) @@ -695,10 +698,13 @@ class TestStackAdopt(TestStack): self.stack_client.create.assert_called_with(**self.defaults) self.stack_client.get.assert_called_with(**{'stack_id': '1234'}) - def test_stack_adopt_wait_fail(self): + @mock.patch('heatclient.common.event_utils.poll_for_events', + return_value=('ADOPT_FAILED', + 'Stack my_stack ADOPT_FAILED')) + def test_stack_adopt_wait_fail(self, mock_poll): arglist = ['my_stack', '--adopt-file', self.adopt_file, '--wait'] self.stack_client.get = mock.MagicMock(return_value=( - stacks.Stack(None, {'stack_status': 'CREATE_FAILED'}))) + stacks.Stack(None, {'stack_status': 'ADOPT_FAILED'}))) parsed_args = self.check_parser(self.cmd, arglist, []) self.assertRaises(exc.CommandError, self.cmd.take_action, parsed_args) |