m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/tests
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
parent67abc395d981b9b4a5f71fc00a8807195e2865e3 (diff)
tests: style
Diffstat (limited to 'tests')
-rwxr-xr-xtests/setup.sh20
-rwxr-xr-xtests/t0001-sanity-checks.sh2
-rwxr-xr-xtests/t0010-generate-tests.sh2
-rwxr-xr-xtests/t0020-show-tests.sh4
-rwxr-xr-xtests/t0050-mv-tests.sh2
-rwxr-xr-xtests/t0060-rm-tests.sh4
-rwxr-xr-xtests/t0100-insert-tests.sh2
-rwxr-xr-xtests/t0200-edit-tests.sh2
8 files changed, 19 insertions, 19 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"
}
diff --git a/tests/t0001-sanity-checks.sh b/tests/t0001-sanity-checks.sh
index f20664e..c052533 100755
--- a/tests/t0001-sanity-checks.sh
+++ b/tests/t0001-sanity-checks.sh
@@ -4,7 +4,7 @@ test_description='Sanity checks'
. ./setup.sh
test_expect_success 'Make sure we can run pass' '
- ${PASS} --help | grep "pass: the standard unix password manager"
+ $PASS --help | grep "pass: the standard unix password manager"
'
test_expect_success 'Make sure we can initialize our test store' '
diff --git a/tests/t0010-generate-tests.sh b/tests/t0010-generate-tests.sh
index 28be31d..5f37397 100755
--- a/tests/t0010-generate-tests.sh
+++ b/tests/t0010-generate-tests.sh
@@ -9,7 +9,7 @@ export TEST_CRED_LEN=24
test_expect_success 'Test "generate" command' '
pass_init &&
echo Generating credential "${TEST_CRED}" with length ${TEST_CRED_LEN} &&
- ${PASS} generate "${TEST_CRED}" ${TEST_CRED_LEN} &&
+ $PASS generate "${TEST_CRED}" ${TEST_CRED_LEN} &&
check_cred "${TEST_CRED}"
'
diff --git a/tests/t0020-show-tests.sh b/tests/t0020-show-tests.sh
index 5f582aa..81ffb07 100755
--- a/tests/t0020-show-tests.sh
+++ b/tests/t0020-show-tests.sh
@@ -8,11 +8,11 @@ export TEST_CRED="test_cred"
test_expect_success 'Test "show" command' '
pass_init &&
create_cred "$TEST_CRED" &&
- ${PASS} show "$TEST_CRED"
+ $PASS show "$TEST_CRED"
'
test_expect_success 'Test "show" of nonexistant password' '
pass_init &&
- test_must_fail ${PASS} show "$TEST_CRED"
+ test_must_fail $PASS show "$TEST_CRED"
'
test_done
diff --git a/tests/t0050-mv-tests.sh b/tests/t0050-mv-tests.sh
index 399868a..d9d4b77 100755
--- a/tests/t0050-mv-tests.sh
+++ b/tests/t0050-mv-tests.sh
@@ -10,7 +10,7 @@ test_expect_success 'Test "mv" command' '
pass_init &&
create_cred "${TEST_CRED}" &&
echo "Moving $TEST_CRED to $TEST_CRED_NEW" &&
- ${PASS} mv "${TEST_CRED}" "${TEST_CRED_NEW}" &&
+ $PASS mv "${TEST_CRED}" "${TEST_CRED_NEW}" &&
check_cred "${TEST_CRED_NEW}" &&
check_no_cred "${TEST_CRED}"
'
diff --git a/tests/t0060-rm-tests.sh b/tests/t0060-rm-tests.sh
index 7c5ad6a..126caa5 100755
--- a/tests/t0060-rm-tests.sh
+++ b/tests/t0060-rm-tests.sh
@@ -9,12 +9,12 @@ test_expect_success 'Test "rm" command' '
pass_init &&
create_cred "${TEST_CRED}" &&
echo "Removing $TEST_CRED" &&
- echo "y" | ${PASS} rm "${TEST_CRED}" &&
+ echo "y" | $PASS rm "${TEST_CRED}" &&
check_no_cred "${TEST_CRED}"
'
test_expect_success 'Test "rm" of non-existent password' '
- test_must_fail ${PASS} rm does-not-exist
+ test_must_fail $PASS rm does-not-exist
'
test_done
diff --git a/tests/t0100-insert-tests.sh b/tests/t0100-insert-tests.sh
index acb892d..b83df32 100755
--- a/tests/t0100-insert-tests.sh
+++ b/tests/t0100-insert-tests.sh
@@ -8,7 +8,7 @@ export TEST_PASSWORD="Hello world"
test_expect_success 'Test "insert" command' '
pass_init &&
- echo "$TEST_PASSWORD" | ${PASS} insert -e "$TEST_CRED" &&
+ echo "$TEST_PASSWORD" | $PASS insert -e "$TEST_CRED" &&
verify_password "$TEST_CRED" "$TEST_PASSWORD"
'
diff --git a/tests/t0200-edit-tests.sh b/tests/t0200-edit-tests.sh
index 27b1794..44dc406 100755
--- a/tests/t0200-edit-tests.sh
+++ b/tests/t0200-edit-tests.sh
@@ -10,7 +10,7 @@ test_expect_success 'Test "edit" command' '
create_cred "$TEST_CRED" &&
export FAKE_EDITOR_PASSWORD="big fat fake password" &&
export EDITOR="$PASSWORD_STORE_TEST_HOME/fake-editor-change-password.sh" &&
- ${PASS} edit "$TEST_CRED" &&
+ $PASS edit "$TEST_CRED" &&
verify_password "$TEST_CRED" "$FAKE_EDITOR_PASSWORD"
'