How to use update_stack method in localstack

Best Python code snippet using localstack_python

test_update_stack.py

Source:test_update_stack.py Github

copy

Full Screen

...47 {"ParameterKey": "SSHLocation", "ParameterValue": "0.0.0.0/0"},48 {"ParameterKey": "Hello", "ParameterValue": "i-0a23663d658dcee1c"},49 {"ParameterKey": "WebServer", "ParameterValue": "Yes"},50 ]51 update_stack()52 cloudformation.execute_with_capabilities.assert_called_with(53 Parameters=[54 {"ParameterKey": "SSHLocation", "ParameterValue": "0.0.0.0/0"},55 {"ParameterKey": "Hello", "ParameterValue": "i-0a23663d658dcee1c"},56 {"ParameterKey": "WebServer", "ParameterValue": "Yes"},57 ],58 StackName="testing1",59 UsePreviousTemplate=True,60 cloudformation_action=ANY,61 )62 # extra args63 cloudformation.wait.return_value = None64 args = MockedArgs()65 args.set_extra_args.return_value = None66 args.extra_args = {"foo": "boo"}67 update_stack(wait=True, extra=True, profile=True, region="us-east-1")68 MockedCloudformation.assert_called_with(True, "us-east-1")69 cloudformation.wait.assert_called_with(70 "stack_update_complete", "Wating for stack to be updated ..."71 )72 cloudformation.execute_with_capabilities.assert_called_with(73 Parameters=[74 {"ParameterKey": "SSHLocation", "ParameterValue": "0.0.0.0/0"},75 {"ParameterKey": "Hello", "ParameterValue": "i-0a23663d658dcee1c"},76 {"ParameterKey": "WebServer", "ParameterValue": "Yes"},77 ],78 StackName="testing1",79 UsePreviousTemplate=True,80 cloudformation_action=ANY,81 foo="boo",82 )83 args.set_extra_args.assert_called_with(84 update=True, search_from_root=False, dryrun=False85 )86 @patch("fzfaws.cloudformation.update_stack.ParamProcessor")87 @patch("fzfaws.cloudformation.update_stack.Cloudformation")88 def test_dryrun(self, MockedCloudformation, MockedParam):89 cloudformation = MockedCloudformation()90 cloudformation.stack_name = "testing1"91 cloudformation.stack_details = {92 "Parameters": [93 {"ParameterKey": "SSHLocation", "ParameterValue": "0.0.0.0/0"},94 {"ParameterKey": "Hello", "ParameterValue": "i-0a23663d658dcee1c"},95 {"ParameterKey": "WebServer", "ParameterValue": "No"},96 ],97 }98 cloudformation.set_stack.return_value = None99 cloudformation.execute_with_capabilities.return_value = {}100 cloudformation.execute_with_capabilities.return_value = {}101 with open(self.data_path, "r") as file:102 cloudformation.client.get_template.return_value = {103 "TemplateBody": file.read()104 }105 paramprocessor = MockedParam()106 paramprocessor.process_stack_params.return_value = None107 paramprocessor.processed_params = [108 {"ParameterKey": "SSHLocation", "ParameterValue": "0.0.0.0/0"},109 {"ParameterKey": "Hello", "ParameterValue": "i-0a23663d658dcee1c"},110 {"ParameterKey": "WebServer", "ParameterValue": "Yes"},111 ]112 result = update_stack(dryrun=True)113 self.assertEqual(114 result,115 {116 "Parameters": [117 {"ParameterKey": "SSHLocation", "ParameterValue": "0.0.0.0/0"},118 {"ParameterKey": "Hello", "ParameterValue": "i-0a23663d658dcee1c"},119 {"ParameterKey": "WebServer", "ParameterValue": "Yes"},120 ],121 "StackName": "testing1",122 "UsePreviousTemplate": True,123 "cloudformation_action": ANY,124 },125 )126 @patch("fzfaws.cloudformation.update_stack.validate_stack")127 @patch.object(Cloudformation, "execute_with_capabilities")128 @patch.object(ParamProcessor, "process_stack_params")129 @patch.object(Pyfzf, "get_local_file")130 @patch.object(Cloudformation, "set_stack")131 def test_local_replacing_update(132 self, mocked_stack, mocked_local, mocked_param, mocked_execute, mocked_validate133 ):134 mocked_local.return_value = self.data_path135 update_stack(local_path=True, root=True, replace=True)136 mocked_local.assert_called_with(search_from_root=True, cloudformation=True)137 mocked_param.assert_called_once()138 mocked_execute.assert_called_with(139 Parameters=[],140 StackName="",141 TemplateBody=ANY,142 cloudformation_action=ANY,143 UsePreviousTemplate=False,144 )145 mocked_validate.assert_called_with(146 "default", "us-east-1", local_path=self.data_path, no_print=True147 )148 mocked_local.reset_mock()149 mocked_param.reset_mock()150 update_stack(local_path=self.data_path, replace=True)151 mocked_local.assert_not_called()152 mocked_param.assert_called_once()153 mocked_execute.assert_called_with(154 Parameters=[],155 StackName="",156 TemplateBody=ANY,157 cloudformation_action=ANY,158 UsePreviousTemplate=False,159 )160 mocked_validate.assert_called_with(161 "default", "us-east-1", local_path=self.data_path, no_print=True162 )163 @patch.object(Cloudformation, "execute_with_capabilities")164 @patch.object(S3, "get_object_url")165 @patch.object(ParamProcessor, "process_stack_params")166 @patch.object(S3, "get_object_data")167 @patch("fzfaws.cloudformation.update_stack.validate_stack")168 @patch.object(S3, "get_object_version")169 @patch.object(Cloudformation, "set_stack")170 def test_s3_replacing_update(171 self,172 mocked_stack,173 mocked_version,174 mocked_validate,175 mocked_data,176 mocked_process,177 mocked_url,178 mocked_execute,179 ):180 fileloader = FileLoader(self.data_path)181 mocked_data.return_value = fileloader.process_yaml_file()182 mocked_version.return_value = [{"VersionId": "111111"}]183 mocked_url.return_value = "https://s3-ap-southeast-2.amazonaws.com/kazhala-lol/hello.yaml?versionId=111111"184 update_stack(replace=True, bucket="kazhala-lol/hello.yaml", version=True)185 mocked_version.assert_called_with("kazhala-lol", "hello.yaml")186 mocked_validate.assert_called_with(187 "default",188 "us-east-1",189 bucket="kazhala-lol/hello.yaml",190 version="111111",191 no_print=True,192 )193 mocked_execute.assert_called_with(194 Parameters=[],195 StackName="",196 TemplateURL="https://s3-ap-southeast-2.amazonaws.com/kazhala-lol/hello.yaml?versionId=111111",197 UsePreviousTemplate=False,198 cloudformation_action=ANY,199 )200 mocked_version.reset_mock()201 update_stack(replace=True, bucket="kazhala-lol/hello.yaml", version="111111")202 mocked_version.assert_not_called()203 mocked_validate.assert_called_with(204 "default",205 "us-east-1",206 bucket="kazhala-lol/hello.yaml",207 version="111111",208 no_print=True,209 )210 mocked_execute.assert_called_with(211 Parameters=[],212 StackName="",213 TemplateURL="https://s3-ap-southeast-2.amazonaws.com/kazhala-lol/hello.yaml?versionId=111111",214 UsePreviousTemplate=False,215 cloudformation_action=ANY,...

Full Screen

Full Screen

uplaunch.py

Source:uplaunch.py Github

copy

Full Screen

...101 "CAPABILITY_NAMED_IAM"102 ]103 )104else:105 response = client.update_stack(106 StackName=update_stack,107 TemplateURL=url,108 Capabilities=[109 "CAPABILITY_NAMED_IAM"110 ]111 )112handle_response(response)113print response...

Full Screen

Full Screen

day11.py

Source:day11.py Github

copy

Full Screen

1example="""54831432232274585471135264556173461413361465635738547864167524645721768417218688288113494846848554105283751526""".split("\n")11with open("day11.txt") as f:12 f = f.read().splitlines()13# Puzzle 114def puzzle_1(data):15 counts = 016 data = [[int(j) for j in i] for i in data]17 for i in range(100):18 c, data = update(data)19 counts += c20 return counts21def update(data):22 update_stack = [(i, j) for i in range(len(data)) for j in range(len(data[0]))]23 while update_stack:24 update_pos = update_stack.pop(-1)25 if update_pos[0] < 0 or\26 update_pos[1] < 0 or\27 update_pos[0] >= len(data) or\28 update_pos[1] >= len(data[0]):29 continue30 if data[update_pos[0]][update_pos[1]] <= 9:31 data[update_pos[0]][update_pos[1]] += 132 if data[update_pos[0]][update_pos[1]] == 10:33 update_stack.append((update_pos[0] - 1, update_pos[1] - 1))34 update_stack.append((update_pos[0] - 0, update_pos[1] - 1))35 update_stack.append((update_pos[0] + 1, update_pos[1] - 1))36 update_stack.append((update_pos[0] - 1, update_pos[1] + 1))37 update_stack.append((update_pos[0] - 0, update_pos[1] + 1))38 update_stack.append((update_pos[0] + 1, update_pos[1] + 1))39 update_stack.append((update_pos[0] - 1, update_pos[1] + 0))40 update_stack.append((update_pos[0] + 1, update_pos[1] + 0))41 new_data = []42 count = 043 for i in data:44 new_data.append([])45 for j in i:46 new_data[-1].append(j if j <=9 else 0)47 count += 0 if j <= 9 else 148 return count, new_data49assert(puzzle_1(example)==1656)50print(puzzle_1(f))51# Puzzle 252def puzzle_2(data):53 data = [[int(j) for j in i] for i in data]54 step = 055 while 1:56 step += 157 c, data = update(data)58 if c == len(data) * len(data[0]):59 return step60assert(puzzle_2(example)==195)...

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