Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_and(function, expected_output):
parameters = {}
mappings = {}
conditions = {}
assert resolve(function, parameters, mappings, conditions) == expected_output
def test_sub_and_ref():
parameters = {"RootDomainName": "skyscanner.net"}
mappings = {}
conditions = {}
function = {"Fn::Sub": ["www.${Domain}", {"Domain": {"Ref": "RootDomainName"}}]}
assert resolve(function, parameters, mappings, conditions) == "www.skyscanner.net"
def test_select_and_ref():
parameters = {"DbSubnetIpBlocks": ["10.0.48.0/24", "10.0.112.0/24", "10.0.176.0/24"]}
mappings = {}
conditions = {}
function = {"Fn::Select": ["0", {"Ref": "DbSubnetIpBlocks"}]}
assert resolve(function, parameters, mappings, conditions) == "10.0.48.0/24"
def test_equals(function, expected_output):
parameters = {}
mappings = {}
conditions = {}
assert resolve(function, parameters, mappings, conditions) == expected_output
def test_sub(function, expected_output):
parameters = {"abc": "ABC"}
mappings = {}
conditions = {}
assert resolve(function, parameters, mappings, conditions) == expected_output
def test_join(function, expected_output):
parameters = {}
mappings = {}
conditions = {}
assert resolve(function, parameters, mappings, conditions) == expected_output
def test_base64(function, expected_output):
parameters = {}
mappings = {}
conditions = {}
assert resolve(function, parameters, mappings, conditions) == expected_output
def test_join_and_ref():
parameters = {"Partition": "patata", "AWS::AccountId": "1234567890"}
mappings = {}
conditions = {}
function = {
"Fn::Join": ["", ["arn:", {"Ref": "Partition"}, ":s3:::elasticbeanstalk-*-", {"Ref": "AWS::AccountId"}]]
}
assert resolve(function, parameters, mappings, conditions) == "arn:patata:s3:::elasticbeanstalk-*-1234567890"
def test_find_in_map(function, expected_output):
parameters = {}
mappings = {"RegionMap": {"us-east-1": {"HVM64": "ami-0ff8a91507f77f867"}}}
conditions = {}
assert resolve(function, parameters, mappings, conditions) == expected_output
def test_condition(function, expected_output):
parameters = {}
mappings = {}
conditions = {"SomeOtherCondition": True}
assert resolve(function, parameters, mappings, conditions) == expected_output