How to use find_stack method in localstack

Best Python code snippet using localstack_python

test_heat_v1.py

Source:test_heat_v1.py Github

copy

Full Screen

1# Licensed under the Apache License, Version 2.0 (the "License"); you may2# not use this file except in compliance with the License. You may obtain3# a copy of the License at4#5# http://www.apache.org/licenses/LICENSE-2.06#7# Unless required by applicable law or agreed to in writing, software8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the10# License for the specific language governing permissions and limitations11# under the License.12import mock13from oslo_config import cfg14from senlin.drivers.openstack import heat_v115from senlin.drivers.openstack import sdk16from senlin.tests.unit.common import base17from senlin.tests.unit.common import utils18class TestHeatV1(base.SenlinTestCase):19 def setUp(self):20 super(TestHeatV1, self).setUp()21 self.context = utils.dummy_context()22 self.conn_params = self.context.to_dict()23 self.mock_conn = mock.Mock()24 self.mock_create = self.patchobject(sdk, 'create_connection',25 return_value=self.mock_conn)26 self.orch = self.mock_conn.orchestration27 self.hc = heat_v1.HeatClient(self.conn_params)28 def test_init(self):29 self.mock_create.assert_called_once_with(self.conn_params)30 self.assertEqual(self.mock_conn, self.hc.conn)31 def test_stack_create(self):32 fake_params = {33 'disable_rollback': True,34 'stack_name': 'fake_stack',35 }36 self.hc.stack_create(**fake_params)37 self.orch.create_stack.assert_called_once_with(**fake_params)38 def test_stack_get(self):39 self.hc.stack_get('stack_id')40 self.orch.get_stack.assert_called_once_with('stack_id')41 def test_stack_find(self):42 self.hc.stack_find('name_or_id')43 self.orch.find_stack.assert_called_once_with('name_or_id')44 def test_stack_list(self):45 self.hc.stack_list()46 self.orch.stacks.assert_called_once_with()47 def test_stack_update(self):48 fake_params = {49 "name": "new_name",50 }51 self.hc.stack_update('stack_id', **fake_params)52 self.orch.update_stack.assert_called_once_with('stack_id',53 **fake_params)54 def test_stack_delete(self):55 self.hc.stack_delete('stack_id', ignore_missing=True)56 self.orch.delete_stack.assert_called_once_with('stack_id', True)57 def test_stack_delete_cannot_miss(self):58 self.hc.stack_check('stack_id')59 self.orch.check_stack.assert_called_once_with('stack_id')60 def test_wait_for_stack(self):61 self.hc.wait_for_stack('FAKE_ID', 'STATUS', [], 100, 200)62 self.orch.find_stack.assert_called_once_with('FAKE_ID', False)63 stk = self.orch.find_stack.return_value64 self.orch.wait_for_status.assert_called_once_with(65 stk, 'STATUS', [], 100, 200)66 def test_wait_for_stack_failures_not_specified(self):67 self.hc.wait_for_stack('FAKE_ID', 'STATUS', None, 100, 200)68 self.orch.find_stack.assert_called_once_with('FAKE_ID', False)69 stk = self.orch.find_stack.return_value70 self.orch.wait_for_status.assert_called_once_with(71 stk, 'STATUS', [], 100, 200)72 def test_wait_for_stack_default_timeout(self):73 cfg.CONF.set_override('default_action_timeout', 361, enforce_type=True)74 self.hc.wait_for_stack('FAKE_ID', 'STATUS', None, 100, None)75 self.orch.find_stack.assert_called_once_with('FAKE_ID', False)76 stk = self.orch.find_stack.return_value77 self.orch.wait_for_status.assert_called_once_with(78 stk, 'STATUS', [], 100, 361)79 def test_wait_for_stack_delete_successful(self):80 fake_stack = mock.Mock(id='stack_id')81 self.orch.find_stack.return_value = fake_stack82 self.hc.wait_for_stack_delete('stack_id')83 self.orch.find_stack.assert_called_once_with('stack_id', True)84 self.orch.wait_for_delete.assert_called_once_with(fake_stack,85 wait=3600)86 def test_wait_for_stack_not_found(self):87 self.orch.find_stack.return_value = None88 self.hc.wait_for_stack('FAKE_ID', 'STATUS', [], 100, 200)89 self.assertEqual(0, self.orch.wait_for_status.call_count)90 def test_wait_for_stack_delete_with_resource_not_found(self):91 self.orch.find_stack.return_value = None92 self.hc.wait_for_stack_delete('stack_id')93 self.orch.find_stack.assert_called_once_with('stack_id', True)94 def test_wait_for_server_delete_with_timeout(self):95 cfg.CONF.set_override('default_action_timeout', 360, enforce_type=True)96 fake_stack = mock.Mock(id='stack_id')97 self.orch.find_stack.return_value = fake_stack98 self.hc.wait_for_stack_delete('stack_id')99 self.orch.wait_for_delete.assert_called_once_with(fake_stack,...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful