aboutsummaryrefslogtreecommitdiff
path: root/test/code.t
diff options
context:
space:
mode:
Diffstat (limited to 'test/code.t')
-rwxr-xr-xtest/code.t20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/code.t b/test/code.t
index 19b4754..1752d77 100755
--- a/test/code.t
+++ b/test/code.t
@@ -65,4 +65,24 @@ EOF
[[ $("$PASS" show passfile) == "$expected" ]]
'
+test_expect_success 'Generates TOTP code for URI with port number' '
+ uri="otpauth://totp/Example:alice@domain.com:443?secret=JBSWY3DPEHPK3PXP&issuer=Example"
+
+ test_pass_init &&
+ "$PASS" otp insert passfile <<< "$uri" &&
+ code=$("$PASS" otp passfile) &&
+ [[ ${#code} -eq 6 ]]
+'
+
+test_expect_success 'Generates HOTP code for URI with port number' '
+ uri="otpauth://hotp/Example:alice@google.com:443?secret=JBSWY3DPEHPK3PXP&counter=10&issuer=Example"
+ inc="otpauth://hotp/Example:alice@google.com:443?secret=JBSWY3DPEHPK3PXP&counter=11&issuer=Example"
+
+ test_pass_init &&
+ "$PASS" otp insert passfile <<< "$uri" &&
+ code=$("$PASS" otp passfile) &&
+ [[ ${#code} -eq 6 ]] &&
+ [[ $("$PASS" otp uri passfile) == "$inc" ]]
+'
+
test_done