fix: test if password is set in a forbidden file even if it also in legitimate file
This commit is contained in:
parent
bbb584bc39
commit
191516ab4f
1 changed files with 19 additions and 0 deletions
|
|
@ -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': []}
|
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()))
|
config_dict = dict(config_to_dict(config.value.get()))
|
||||||
assert config_dict == {'secret1': None, 'secret2': 'value'}
|
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'}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue