aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTad Fisher <tadfisher@gmail.com>2018-03-04 11:23:14 -0800
committerGitHub <noreply@github.com>2018-03-04 11:23:14 -0800
commit948c2f04cbaf2f065b0c21b80de82f1f0c946e54 (patch)
tree4549da42122c877121c38b2956abf5fbd479c554 /test
parentfc8a147156ceedf862d92987e2f795ea4e22513f (diff)
downloadpass-otp-948c2f04cbaf2f065b0c21b80de82f1f0c946e54.tar.gz
pass-otp-948c2f04cbaf2f065b0c21b80de82f1f0c946e54.zip
Fail for `otp code` on missing secret (#46)
Diffstat (limited to 'test')
-rwxr-xr-xtest/code.t10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/code.t b/test/code.t
index 02bd086..39310fb 100755
--- a/test/code.t
+++ b/test/code.t
@@ -4,6 +4,12 @@ export test_description='Tests pass otp code generation'
. ./setup.sh
+test_expect_success 'Fails for missing secret' '
+ test_pass_init &&
+ "$PASS" insert passfile <<< "12345"
+ test_expect_code 1 pass otp passfile
+'
+
test_expect_success 'Generates TOTP code' '
uri="otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example"
@@ -31,14 +37,14 @@ test_expect_success 'HOTP counter increments and preserves multiline contents' '
read -r -d "" existing <<EOF
foo bar baz
zab rab oof
-$uri1
+$uri
baz bar foo
EOF
read -r -d "" expected <<EOF
foo bar baz
zab rab oof
-$uri2
+$inc
baz bar foo
EOF