m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/tests/setup.sh
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-04-23 05:01:43 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-04-23 05:01:43 +0200
commit25f9608022803d2d130e9665dc3f14bed83ba328 (patch)
treee145ed52bddd9f41a9e0a4df56a468bff6a8e513 /tests/setup.sh
parent67abc395d981b9b4a5f71fc00a8807195e2865e3 (diff)
tests: style
Diffstat (limited to 'tests/setup.sh')
-rwxr-xr-xtests/setup.sh20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/setup.sh b/tests/setup.sh
index b5729e4..15c0d28 100755
--- a/tests/setup.sh
+++ b/tests/setup.sh
@@ -2,7 +2,7 @@
#
# This scripts sets the following:
# ${GNUPGHOME} Full path to test GPG directory
-# ${PASS} Full path to password-store script to test
+# $PASS Full path to password-store script to test
# ${PASSWORD_STORE_KEY} GPG key id of testing key
# ${PASSWORD_STORE_TEST_HOME} This folder
@@ -16,7 +16,7 @@ PASSWORD_STORE_TEST_HOME="$(cd "$(dirname "$BASH_SOURCE")"; pwd)"
PASS="${PASSWORD_STORE_TEST_HOME}/../src/password-store.sh"
-if ! test -e ${PASS} ; then
+if [[ ! -e $PASS ]]; then
echo "Could not find password-store.sh"
exit 1
fi
@@ -26,7 +26,7 @@ fi
# Where the test keyring and test key id
# Note: the assumption is the test key is unencrypted.
-export GNUPGHOME=$(pwd)"/gnupg/"
+export GNUPGHOME="${PASSWORD_STORE_TEST_HOME}/gnupg/"
chmod 700 "$GNUPGHOME"
export PASSWORD_STORE_KEY="3DEEA12D" # "Password-store Test Key"
GPG="gpg"
@@ -56,7 +56,7 @@ pass_init() {
fi
fi
- ${PASS} init ${PASSWORD_STORE_KEY} || return 1
+ $PASS init ${PASSWORD_STORE_KEY} || return 1
echo "Initialization of ${PASSWORD_STORE_DIR} complete."
}
@@ -76,11 +76,11 @@ check_cred() {
local cred="$1"
shift
echo "Checking credential ${cred}"
- if ! ${PASS} show "$cred"; then
+ if ! $PASS show "$cred"; then
echo "Credential ${cred} does not exist"
return 1
fi
- if [[ -z "$(${PASS} show "$cred")" ]]; then
+ if [[ -z "$($PASS show "$cred")" ]]; then
echo "Credential ${cred} empty"
return 1
fi
@@ -101,7 +101,7 @@ check_no_cred() {
local cred="$1"
shift
echo "Checking for lack of credential ${cred}"
- ${PASS} show "$cred" || return 0
+ $PASS show "$cred" || return 0
echo "Credential ${cred} exists."
return 1
}
@@ -131,10 +131,10 @@ create_cred() {
echo "Using password \"$password\" for $cred"
# TODO: Working around bug with 'pass insert' returning non-zero.
# Fix this code to exit on error when that is fixed.
- ${PASS} insert -e "$cred" <<<"$password" || true
+ $PASS insert -e "$cred" <<<"$password" || true
else
echo "Generating random password for $cred"
- if ! ${PASS} generate "${cred}" 24 > /dev/null; then
+ if ! $PASS generate "${cred}" 24 > /dev/null; then
echo "Failed to create credential ${cred}"
return 1
fi
@@ -161,7 +161,7 @@ verify_password() {
check_cred "$cred" || return 1
local actualfile="${SHARNESS_TRASH_DIRECTORY}/verify-password-actual.$RANDOM.$RANDOM.$RANDOM.$RANDOM"
local expectedfile="${SHARNESS_TRASH_DIRECTORY}/verify-password-expected.$RANDOM.$RANDOM.$RANDOM.$RANDOM"
- ${PASS} show "$TEST_CRED" | sed -n 1p > "$actualfile" &&
+ $PASS show "$TEST_CRED" | sed -n 1p > "$actualfile" &&
echo "$expected" > "$expectedfile" &&
test_cmp "$expectedfile" "$actualfile"
}