aboutsummaryrefslogtreecommitdiff
path: root/test/insert.t
diff options
context:
space:
mode:
authorOsamu Matsumoto <osamu.matsumoto@gmail.com>2018-01-22 06:23:32 +0900
committerTad Fisher <tadfisher@gmail.com>2018-01-21 13:23:32 -0800
commitb8009511b32a5d502148ad8a8397c9cfd7c75a40 (patch)
tree345281ea1916001d7398f34317ebf2f1e908cfd6 /test/insert.t
parent33f390ba2297f9f2117516d5a7b34b237c7116a3 (diff)
Add secret option (#43)
* Support insert/append secret directly * Validate issuer and accout name option in secret directly mode * Add test for secret option * Fix up docs
Diffstat (limited to 'test/insert.t')
-rwxr-xr-xtest/insert.t18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/insert.t b/test/insert.t
index e0d2441..1c8ddb2 100755
--- a/test/insert.t
+++ b/test/insert.t
@@ -112,4 +112,22 @@ test_expect_success 'Force overwrites key URI' '
[[ $("$PASS" show passfile) == "$uri2" ]]
'
+test_expect_success 'Insert passfile from secret with options(issuer, accountname)' '
+ secret="JBSWY3DPEHPK3PXP"
+ uri="otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example"
+
+ test_pass_init &&
+ "$PASS" otp insert -s -i Example -a alice@google.com passfile <<< "$secret" &&
+ echo [[ $("$PASS" show passfile) == "$uri" ]]
+'
+
+test_expect_success 'Insert from secret without passfile' '
+ secret="JBSWY3DPEHPK3PXP"
+ uri="otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example"
+
+ test_pass_init &&
+ "$PASS" otp insert -s -i Example -a alice@google.com <<< "$secret" &&
+ echo [[ $("$PASS" show Example/alice@google.com) == "$uri" ]]
+'
+
test_done