2nd Draft

This commit is contained in:
2025-03-30 16:19:56 +00:00
parent 863c954144
commit 92ebc77597
2 changed files with 41 additions and 1 deletions

View File

@@ -2683,7 +2683,7 @@ properties:
description: |
Command to use instead of "keepassxc-cli".
example: /usr/local/bin/keepassxc-cli
key_file:
key-file:
type: string
description: |
Path to a key file for unlocking the KeePassXC database.

View File

@@ -181,3 +181,43 @@ def test_load_credential_with_yubikey():
)
== 'password'
)
def test_load_credential_with_key_file_and_yubikey():
flexmock(module.os.path).should_receive('expanduser').with_args('database.kdbx').and_return(
'database.kdbx'
)
flexmock(module.os.path).should_receive('exists').and_return(True)
flexmock(module.borgmatic.execute).should_receive(
'execute_command_and_capture_output'
).with_args(
(
'keepassxc-cli',
'show',
'--show-protected',
'--attributes',
'Password',
'database.kdbx',
'mypassword',
'--key-file',
'/path/to/keyfile',
'--yubikey',
)
).and_return(
'password'
).once()
assert (
module.load_credential(
hook_config={},
config={},
credential_parameters=(
'database.kdbx',
'mypassword',
'--key-file',
'/path/to/keyfile',
'--yubikey',
),
)
== 'password'
)