fix: support hidden attribut

This commit is contained in:
egarette@silique.fr 2025-02-17 15:25:59 +01:00
parent 5d8dd6881f
commit 82e0c371a0
5 changed files with 27 additions and 8 deletions

View file

@ -85,7 +85,7 @@ class RougailUserDataBitwarden:
self.bitwarden_command_line = bitwarden_command_line
def run(self):
self.set_passwords(self.config)
self.set_passwords(self.config.forcepermissive)
return {'errors': self.errors,
'warnings': self.warnings,
}

View file

@ -1,12 +1,12 @@
{
"rougail.leader.username": [
{
"rougail.leader.username": "test_multi_username1",
"rougail.leader.secret": "test_multi_password1"
},
{
"rougail.leader.username": "test_multi_username2",
"rougail.leader.secret": "test_multi_password2"
},
{
"rougail.leader.username": "test_multi_username1",
"rougail.leader.secret": "test_multi_password1"
}
]
}

View file

@ -1,6 +1,6 @@
{
"errors": [
"several items found with name \"test_secret_\" from Bitwarden for \"rougail.secret\": \"test_secret_1\", \"test_secret_2\""
"cannot execute the \"rbw\" commandline from Bitwarden for \"rougail.secret\": rbw get: couldn't find entry for 'test_secret_': multiple entries found: bitwarden_username_2@test_secret_2, bitwarden_username@test_secret_1\n (1)"
],
"warnings": []
}

View file

@ -0,0 +1,15 @@
---
version: 1.1
username:
description: the username
type: unix_user
default: test_secret_1
bitwarden: true
secret:
description: the secret
type: secret
hidden: true
default: test_secret_1
bitwarden: true

View file

@ -25,7 +25,7 @@ def _test_dictionaries(test_dir):
# loads variables in the tiramisu config
errors = RougailUserData(config, rougailconfig=rougailconfig).run()
#expected output
config_dict = dict(config_to_dict(config.value.get()))
config_dict = dict(config_to_dict(config.forcepermissive.value.get()))
ok_file = Path('tests') / 'results' / test_dir.name / 'makedict' / 'bitwarden.json'
if not ok_file.is_file():
ok_file.parent.mkdir(parents=True, exist_ok=True)
@ -46,7 +46,6 @@ def _test_dictionaries(test_dir):
# }
assert expected_errors == errors
#
config.property.read_only()
assert expected == config_dict
@ -65,6 +64,11 @@ def test_dictionaries_2_username_secret_invalid():
_test_dictionaries(test_dir / '2_username_secret_invalid')
def test_dictionaries_2_username_secret_hidden():
"tests the output"
_test_dictionaries(test_dir / '2_username_secret_hidden')
def test_dictionaries_3_leadership_secret():
"tests the output"
_test_dictionaries(test_dir / '3_leadership_secret')