From acfab191e6bb33f840f0a7106c3eb4cd1ab76267 Mon Sep 17 00:00:00 2001 From: Tad Fisher Date: Sun, 19 Mar 2017 23:09:24 -0700 Subject: Support --echo and reading key from stdin --- test/insert.t | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test') diff --git a/test/insert.t b/test/insert.t index da6477c..0c19d11 100755 --- a/test/insert.t +++ b/test/insert.t @@ -32,4 +32,28 @@ test_expect_success 'Force overwrites key URI' ' [[ $("$PASS" show passfile) == "$uri2" ]] ' +test_expect_success 'Reads non-terminal input' ' + uri="otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example" + + test_pass_init && + "$PASS" otp insert passfile <<< "$uri" && + [[ $("$PASS" show passfile) == "$uri" ]] +' + +test_expect_success 'Reads terminal input in noecho mode' ' + uri="otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example" + + test_pass_init && + test_faketty "$PASS" otp insert passfile < <(echo -ne "$uri\n$uri\n") && + [[ $("$PASS" show passfile) == "$uri" ]] +' + +test_expect_success 'Reads terminal input in echo mode' ' + uri="otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example" + + test_pass_init && + test_faketty "$PASS" otp insert -e passfile <<< "$uri" && + [[ $("$PASS" show passfile) == "$uri" ]] +' + test_done -- cgit v1.2.3