-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed6ca76
commit 7afa933
Showing
5 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# pylint:disable=C0114,C0116,C0103,W0612 | ||
|
||
from unittest import TestCase | ||
|
||
from hcl2.transformer import DictTransformer | ||
|
||
|
||
class TestDictTransformer(TestCase): | ||
"""Test behaviour of hcl2.transformer.DictTransformer class""" | ||
|
||
@staticmethod | ||
def build_dict_transformer(with_meta: bool = False) -> DictTransformer: | ||
return DictTransformer(with_meta) | ||
|
||
def test_to_string_dollar(self): | ||
string_values = { | ||
'"bool"': "bool", | ||
'"number"': "number", | ||
'"string"': "string", | ||
"${value_1}": "${value_1}", | ||
'"value_2': '${"value_2}', | ||
'value_3"': '${value_3"}', | ||
'"value_4"': "value_4", | ||
"value_5": "${value_5}", | ||
} | ||
|
||
dict_transformer = self.build_dict_transformer() | ||
|
||
for value, expected in string_values.items(): | ||
actual = dict_transformer.to_string_dollar(value) | ||
|
||
self.assertEqual(actual, expected) |