aboutsummaryrefslogtreecommitdiff
path: root/test/uri.t
diff options
context:
space:
mode:
Diffstat (limited to 'test/uri.t')
-rwxr-xr-xtest/uri.t23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/uri.t b/test/uri.t
new file mode 100755
index 0000000..084b010
--- /dev/null
+++ b/test/uri.t
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+
+export test_description='Tests pass otp URI parsing'
+
+. ./setup.sh
+
+test_expect_success 'Shows key URI in single-line passfile' '
+ uri="otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example"
+
+ test_pass_init &&
+ "$PASS" otp insert "$uri" passfile &&
+ [[ $("$PASS" otp uri passfile) == "$uri" ]]
+'
+
+test_expect_success 'Shows key URI in multi-line passfile' '
+ uri="otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example"
+
+ test_pass_init &&
+ "$PASS" insert -m passfile < <(echo -e "password\nfoo\n$uri\nbar") &&
+ [[ $("$PASS" otp uri passfile) == "$uri" ]]
+'
+
+test_done