From a895a044e9408d0301d0d207a9729dea2df6c7fa Mon Sep 17 00:00:00 2001 From: angrybayblade Date: Tue, 26 Dec 2023 10:08:25 +0530 Subject: [PATCH] test: default value parsing on the env var parser --- tests/test_helpers/test_env_vars.py | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/test_helpers/test_env_vars.py b/tests/test_helpers/test_env_vars.py index 4a9350b8e2..e0fde93864 100644 --- a/tests/test_helpers/test_env_vars.py +++ b/tests/test_helpers/test_env_vars.py @@ -226,6 +226,37 @@ def test_match_export_parse_consistency(export_data, template) -> None: assert parsed_data == export_data +@pytest.mark.parametrize( + ("template", "parsed"), + argvalues=[ + ( + {"value": "${str:john}"}, + {"value": "john"}, + ), + ( + {"value": "${int:3}"}, + {"value": 3}, + ), + ( + {"value": "${bool:false}"}, + {"value": False}, + ), + ( + {"value": '${list:["foo","bar"]}'}, + {"value": ["foo", "bar"]}, + ), + ( + {"value": '${dict:{"foo":"bar"}}'}, + {"value": {"foo": "bar"}}, + ), + ], +) +def test_parse_defaults(template, parsed) -> None: + """Test default value parsing.""" + parsed_data = apply_env_variables(template, env_variables={}) + assert parsed_data == parsed + + def test_apply_env_variables_on_agent_config(): """Test apply_env_variables_on_agent_config function.""" result = apply_env_variables_on_agent_config(