From 191516ab4fb443d4bb2ee619da441c11f2160c84 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 11 Feb 2026 19:43:00 +0100 Subject: [PATCH] fix: test if password is set in a forbidden file even if it also in legitimate file --- tests/test_load.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_load.py b/tests/test_load.py index 85387c5..b8f1729 100644 --- a/tests/test_load.py +++ b/tests/test_load.py @@ -332,3 +332,22 @@ def test_secret_last_error(): assert errors == {'errors': [[['the variable contains secrets and should not be defined in the YAML file "tests/secrets/secret.yml"', 'secret1', None]]], 'warnings': []} config_dict = dict(config_to_dict(config.value.get())) assert config_dict == {'secret1': None, 'secret2': 'value'} + + +def test_secret_last_error_with_first(): + root_test_dir / '00_6secret' + rougailconfig = get_rougail_config(root_test_dir / '00_6secret', namespace=False) + rougailconfig['step.user_data'] = ['yaml'] + rougailconfig["yaml.file_with_secrets"] = "last" + rougailconfig["yaml.filename"] = ["tests/secrets/secret.yml", "tests/secrets/secret2.yml"] + rougail = Rougail(rougailconfig) + config = rougail.run() + user_data = RougailUserData(config, rougailconfig=rougailconfig).run() + errors = rougail.user_data(user_data) + for l, data in errors.items(): + for i, d in enumerate(data): + if isinstance(d, dict): + data[i] = [[l, v.path, v.index] for l, v in d.items()] + assert errors == {'errors': [[['the variable contains secrets and should not be defined in the YAML file "tests/secrets/secret.yml"', 'secret1', None]]], 'warnings': []} + config_dict = dict(config_to_dict(config.value.get())) + assert config_dict == {'secret1': None, 'secret2': 'value'}