aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTad Fisher <tad@simple.com>2017-03-19 16:23:26 -0700
committerTad Fisher <tad@simple.com>2017-03-19 16:23:26 -0700
commit3aeea0b8ab9c7bbbfdf403fe5e0908a1160ef08b (patch)
tree2f039bf847a7235b99be3c55365ef49122df1fb1 /test
parent8367284176c086d3bf203923bbd0abd9c0786e33 (diff)
downloadpass-otp-3aeea0b8ab9c7bbbfdf403fe5e0908a1160ef08b.tar.gz
pass-otp-3aeea0b8ab9c7bbbfdf403fe5e0908a1160ef08b.zip
Replace cmd_insert_$type with cmd_insert_spec; insert key uris
Diffstat (limited to 'test')
-rwxr-xr-xtest/insert.t28
1 files changed, 27 insertions, 1 deletions
diff --git a/test/insert.t b/test/insert.t
index dbd6e2a..eb04898 100755
--- a/test/insert.t
+++ b/test/insert.t
@@ -33,8 +33,34 @@ test_expect_success 'Force overwrites key URI' '
'
test_expect_success 'Inserts a basic TOTP key' '
+ uri="otpauth://totp/passfile?secret=AAAAAAAAAAAAAAAAAAAAA"
+
+ test_pass_init &&
+ "$PASS" otp insert totp -s AAAAAAAAAAAAAAAAAAAAA passfile &&
+ [[ $("$PASS" show passfile) == "$uri" ]]
+'
+
+test_expect_success 'Inserts a TOTP key with issuer in path' '
+ uri="otpauth://totp/example.com:passfile?secret=AAAAAAAAAAAAAAAAAAAAA&issuer=example.com"
+
+ test_pass_init &&
+ "$PASS" otp insert totp -s AAAAAAAAAAAAAAAAAAAAA example.com/passfile &&
+ [[ $("$PASS" show example.com/passfile) == "$uri" ]]
+'
+
+test_expect_success 'Inserts a TOTP key with issuer in nested path' '
+ uri="otpauth://totp/foo:passfile?secret=AAAAAAAAAAAAAAAAAAAAA&issuer=foo"
+
+ test_pass_init &&
+ "$PASS" otp insert totp -s AAAAAAAAAAAAAAAAAAAAA example.com/foo/passfile &&
+ [[ $("$PASS" show example.com/foo/passfile) == "$uri" ]]
+'
+
+test_expect_success 'Inserts a TOTP key with spaces in path' '
+ uri="otpauth://totp/example%20dot%20com:pass%20file?secret=AAAAAAAAAAAAAAAAAAAAA&issuer=example%20dot%20com"
test_pass_init &&
- "$PASS" otp insert totp -s AAAAAAAAAAAAAAAAAAAAA passfile
+ "$PASS" otp insert totp -s AAAAAAAAAAAAAAAAAAAAA "example dot com/pass file" &&
+ [[ $("$PASS" show "example dot com/pass file") == "$uri" ]]
'
test_expect_success 'Commits insert to git' '