Skip to content

Commit

Permalink
ps test gpg-agent only
Browse files Browse the repository at this point in the history
  • Loading branch information
sschmid committed Oct 19, 2024
1 parent 401bd94 commit 4052699
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/gpg.bats
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ teardown() {
# helpers
################################################################################

# shellcheck disable=SC2009
_ps() {
ps -A | grep "gpg-agent --homedir ${GNUPGHOME}" | grep -v grep
}

_gpg_decrypt() {
gpg --quiet --batch --pinentry-mode loopback --passphrase "${KEYCHAIN_TEST_PASSWORD}" \
--decrypt "${PW_KEYCHAIN}/$1" | sed -n "$2"
Expand Down Expand Up @@ -360,15 +365,15 @@ EOF
################################################################################

@test "unlocks keychain" {
run pgrep -f "gpg-agent"
run _ps
assert_failure
refute_output

run pw unlock <<< "${KEYCHAIN_TEST_PASSWORD}"
assert_success
refute_output

run pgrep -f "gpg-agent"
run _ps
assert_success
assert_output
}
Expand All @@ -378,15 +383,15 @@ EOF
_skip_manual_test "pw_test_password - Press enter to continue ..."
read -rsp "Press enter to continue ..."

run pgrep -f "gpg-agent"
run _ps
assert_failure
refute_output

run pw unlock
assert_success
refute_output

run pgrep -f "gpg-agent"
run _ps
assert_success
assert_output
}
Expand Down

0 comments on commit 4052699

Please sign in to comment.