Skip to content

Commit

Permalink
feat: add test for read_template
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanholsteijn committed Feb 23, 2024
1 parent 2743c7c commit 5c6bbe2
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions tests/test_add_new_resources.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from aws_cfn_update.rest_api_body_updater import RestAPIBodyUpdater
import json
import pathlib
import tempfile

from ruamel.yaml import YAML

from aws_cfn_update.add_missing_resources import add_missing_resources
from aws_cfn_update.cfn_updater import CfnUpdater
from aws_cfn_update.cfn_updater import read_template


def test_simple():
Expand Down Expand Up @@ -35,3 +37,14 @@ def test_add_no_outputs():
result = add_missing_resources(target, source)
assert target["Resources"].get("EC2Instance")
assert not target.get("Outputs")


def test_read_template():
source = {
"Resources": {"AMI": {}, "EC2Instance": {"ImageId": {"Ref": "AMI"}}},
"Outputs": {"XXX": {"Value": "bla"}},
}
with tempfile.NamedTemporaryFile(suffix=".yaml") as f:
YAML(typ="safe").dump(source, pathlib.Path(f.name))
result = read_template(f.name)
assert source == result

0 comments on commit 5c6bbe2

Please sign in to comment.