fix: support hidden attribut
This commit is contained in:
parent
5d8dd6881f
commit
82e0c371a0
5 changed files with 27 additions and 8 deletions
|
@ -85,7 +85,7 @@ class RougailUserDataBitwarden:
|
||||||
self.bitwarden_command_line = bitwarden_command_line
|
self.bitwarden_command_line = bitwarden_command_line
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.set_passwords(self.config)
|
self.set_passwords(self.config.forcepermissive)
|
||||||
return {'errors': self.errors,
|
return {'errors': self.errors,
|
||||||
'warnings': self.warnings,
|
'warnings': self.warnings,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"rougail.leader.username": [
|
"rougail.leader.username": [
|
||||||
{
|
|
||||||
"rougail.leader.username": "test_multi_username1",
|
|
||||||
"rougail.leader.secret": "test_multi_password1"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"rougail.leader.username": "test_multi_username2",
|
"rougail.leader.username": "test_multi_username2",
|
||||||
"rougail.leader.secret": "test_multi_password2"
|
"rougail.leader.secret": "test_multi_password2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rougail.leader.username": "test_multi_username1",
|
||||||
|
"rougail.leader.secret": "test_multi_password1"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"errors": [
|
"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": []
|
"warnings": []
|
||||||
}
|
}
|
15
tests/structures/2_username_secret_hidden/00-base.yml
Normal file
15
tests/structures/2_username_secret_hidden/00-base.yml
Normal 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
|
|
@ -25,7 +25,7 @@ def _test_dictionaries(test_dir):
|
||||||
# loads variables in the tiramisu config
|
# loads variables in the tiramisu config
|
||||||
errors = RougailUserData(config, rougailconfig=rougailconfig).run()
|
errors = RougailUserData(config, rougailconfig=rougailconfig).run()
|
||||||
#expected output
|
#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'
|
ok_file = Path('tests') / 'results' / test_dir.name / 'makedict' / 'bitwarden.json'
|
||||||
if not ok_file.is_file():
|
if not ok_file.is_file():
|
||||||
ok_file.parent.mkdir(parents=True, exist_ok=True)
|
ok_file.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
@ -46,7 +46,6 @@ def _test_dictionaries(test_dir):
|
||||||
# }
|
# }
|
||||||
assert expected_errors == errors
|
assert expected_errors == errors
|
||||||
#
|
#
|
||||||
config.property.read_only()
|
|
||||||
assert expected == config_dict
|
assert expected == config_dict
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,6 +64,11 @@ def test_dictionaries_2_username_secret_invalid():
|
||||||
_test_dictionaries(test_dir / '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():
|
def test_dictionaries_3_leadership_secret():
|
||||||
"tests the output"
|
"tests the output"
|
||||||
_test_dictionaries(test_dir / '3_leadership_secret')
|
_test_dictionaries(test_dir / '3_leadership_secret')
|
||||||
|
|
Loading…
Reference in a new issue