From dd7824f431c4cc8b52e01b5b84c7a178229755d2 Mon Sep 17 00:00:00 2001 From: Tad Fisher Date: Mon, 20 Mar 2017 13:52:25 -0700 Subject: Add cmd_otp_append for appending OTP secrets to existing passfiles --- test/append.t | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/code.t | 24 +++++++++++ 2 files changed, 149 insertions(+) create mode 100755 test/append.t (limited to 'test') diff --git a/test/append.t b/test/append.t new file mode 100755 index 0000000..bba3c60 --- /dev/null +++ b/test/append.t @@ -0,0 +1,125 @@ +#!/usr/bin/env bash + +export test_description="Tests pass otp append commands" + +. ./setup.sh + +test_expect_success 'Reads non-terminal input' ' + existing="foo bar baz" + uri="otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Foo" + + test_pass_init && + "$PASS" insert -e passfile <<< "$existing" && + "$PASS" otp append -e passfile <<< "$uri" && + [[ $("$PASS" otp uri passfile) == "$uri" ]] +' + +test_expect_success 'Reads terminal input in noecho mode' ' + existing="foo bar baz" + uri="otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example" + + test_pass_init && + "$PASS" insert -e passfile <<< "$existing" && + { expect -d <