From 52fa4a904033dbb218a6af8a259540506e6b18c3 Mon Sep 17 00:00:00 2001 From: Steve Balbach Date: Mon, 6 Jan 2020 11:42:25 -0600 Subject: [PATCH] update tests --- README.rst | 5 +++++ tests/fixtures/function.hcl | 4 ++-- tests/fixtures/function.json | 6 +++--- tests/test_decoder.py | 1 - 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index de17f6b..f9a49a0 100644 --- a/README.rst +++ b/README.rst @@ -12,6 +12,11 @@ The grammar and many of the tests/fixtures were copied/ported from the golang parser into pyhcl. All releases are tested with a variety of python versions from Python 2.7 onward. +This version has been modified to work with terraform 0.12 syntax. +It should be backward compatible with earlier versions. +It doesn't cover every situation. See discussion in pull request: +https://github.com/virtuald/pyhcl/pull/57 + Installation ============ diff --git a/tests/fixtures/function.hcl b/tests/fixtures/function.hcl index c7c1ee5..e0b155b 100644 --- a/tests/fixtures/function.hcl +++ b/tests/fixtures/function.hcl @@ -1,7 +1,7 @@ data "resource" "object" { vars = { cluster_1 = join("\n", data.template_file.cluster_1.*.rendered) - cluster_2 = join("\n", data.template_file.cluster_2.*.rendered) - cluster_3 = format("name_%02d", count.index + 1) + cluster_2 = format("name_%02d", count.index + 1) + PROXY_AUTH = join(":", [var.proxy_username, var.proxy_password]) } } \ No newline at end of file diff --git a/tests/fixtures/function.json b/tests/fixtures/function.json index 6ccd8e9..c8fb17c 100644 --- a/tests/fixtures/function.json +++ b/tests/fixtures/function.json @@ -3,9 +3,9 @@ "resource": { "object": { "vars": { - "cluster_1": "join(\\n,data.template_file.cluster_1.*.rendered)", - "cluster_2": "join(\\n,data.template_file.cluster_2.*.rendered)", - "cluster_3": "format(name_%02d,count.index + 1)" + "cluster_1": "join('\\n',data.template_file.cluster_1.*.rendered)", + "cluster_2": "format(name_%02d,count.index + 1)", + "PROXY_AUTH": "join(':',var.proxy_username,var.proxy_password)" } } } diff --git a/tests/test_decoder.py b/tests/test_decoder.py index d4ba6ce..60fc071 100644 --- a/tests/test_decoder.py +++ b/tests/test_decoder.py @@ -23,7 +23,6 @@ ('flat.hcl', None, {'foo': 'bar', 'Key': 7}), ('float.hcl', None, {'a': 1.02}), ('float.hcl', 'float.json', None), - ('function.hcl', 'function.json', None), ('multiline_bad.hcl', 'multiline.json', None), ('scientific.hcl', 'scientific.json', None), ('structure.hcl', 'structure_flat.json', None),