How to use _resolve_refs_in_template method in localstack

Best Python code snippet using localstack_python

test_cloudformation.py

Source:test_cloudformation.py Github

copy

Full Screen

...21 "/invocations",22 ],23 ]24 }25 result = _resolve_refs_in_template(ref)26 pattern = r"arn:aws:apigateway:.*:lambda:path/2015-03-31/functions/test:lambda:arn/invocations"27 assert re.match(pattern, result)28def test_sub_numeric_value():29 template = {"test": {"Sub": "${TestNumValue}"}}30 result = _resolve_refs_in_template(template, stack_params={"TestNumValue": 1234})31 assert result == {"test": "1234"}32def test_is_local_service_url():33 local_urls = [34 "http://localhost",35 "https://localhost",36 "http://localhost:4566",37 "https://localhost:4566",38 "http://localhost.localstack.cloud:4566",39 "https://s3.localhost.localstack.cloud",40 "http://mybucket.s3.localhost.localstack.cloud:4566",41 "https://mybucket.s3.localhost",42 ]43 remote_urls = [44 "https://mybucket.s3.amazonaws.com",45 "http://mybucket.s3.us-east-1.amazonaws.com",46 ]47 for url in local_urls:48 assert template_preparer.is_local_service_url(url)49 for url in remote_urls:50 assert not template_preparer.is_local_service_url(url)51def test_apply_substitutions():52 blubstr = "something ${foo} and ${test} + ${foo}"53 subs = {"foo": "bar", "test": "resolved"}54 assert _apply_substitutions(blubstr, subs) == "something bar and resolved + bar"55def test_remove_none_values():56 template = {57 "Properties": {58 "prop1": 123,59 "nested": {"test1": PLACEHOLDER_AWS_NO_VALUE, "test2": None},60 "list": [1, 2, PLACEHOLDER_AWS_NO_VALUE, 3, None],61 }62 }63 result = remove_none_values(template)64 assert result == {"Properties": {"prop1": 123, "nested": {}, "list": [1, 2, 3]}}65def _resolve_refs_in_template(template, stack_params: Dict = None):66 stack = Stack({"StackName": "test"})67 stack.stack_parameters()68 stack_params = stack_params or {}69 stack_params = [{"ParameterKey": k, "ParameterValue": v} for k, v in stack_params.items()]70 stack.metadata["Parameters"].extend(stack_params)...

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