aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTad Fisher <tad@simple.com>2017-03-19 23:09:24 -0700
committerTad Fisher <tad@simple.com>2017-03-19 23:46:02 -0700
commitacfab191e6bb33f840f0a7106c3eb4cd1ab76267 (patch)
tree81413f5fa35c8d74276307820dc61a0c97739931 /test
parent318febc9ec78ab35ae4021472bd8ce29a5389c4b (diff)
downloadpass-otp-acfab191e6bb33f840f0a7106c3eb4cd1ab76267.tar.gz
pass-otp-acfab191e6bb33f840f0a7106c3eb4cd1ab76267.zip
Support --echo and reading key from stdin
Diffstat (limited to 'test')
-rwxr-xr-xtest/insert.t24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/insert.t b/test/insert.t
index da6477c..0c19d11 100755
--- a/test/insert.t
+++ b/test/insert.t
@@ -32,4 +32,28 @@ test_expect_success 'Force overwrites key URI' '
[[ $("$PASS" show passfile) == "$uri2" ]]
'
+test_expect_success 'Reads non-terminal input' '
+ uri="otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example"
+
+ test_pass_init &&
+ "$PASS" otp insert passfile <<< "$uri" &&
+ [[ $("$PASS" show passfile) == "$uri" ]]
+'
+
+test_expect_success 'Reads terminal input in noecho mode' '
+ uri="otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example"
+
+ test_pass_init &&
+ test_faketty "$PASS" otp insert passfile < <(echo -ne "$uri\n$uri\n") &&
+ [[ $("$PASS" show passfile) == "$uri" ]]
+'
+
+test_expect_success 'Reads terminal input in echo mode' '
+ uri="otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example"
+
+ test_pass_init &&
+ test_faketty "$PASS" otp insert -e passfile <<< "$uri" &&
+ [[ $("$PASS" show passfile) == "$uri" ]]
+'
+
test_done