diff options
author | Tad Fisher <tad@simple.com> | 2017-03-20 13:52:25 -0700 |
---|---|---|
committer | Tad Fisher <tad@simple.com> | 2017-03-20 13:52:25 -0700 |
commit | dd7824f431c4cc8b52e01b5b84c7a178229755d2 (patch) | |
tree | 550c79bcaaaf946f0333c13c4a2000667d4c0085 /test/code.t | |
parent | b6b23de6f787c3fc244484f613f84ffa6e3cb201 (diff) |
Add cmd_otp_append for appending OTP secrets to existing passfiles
Diffstat (limited to 'test/code.t')
-rwxr-xr-x | test/code.t | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/code.t b/test/code.t index 4faea03..02bd086 100755 --- a/test/code.t +++ b/test/code.t @@ -24,4 +24,28 @@ test_expect_success 'Generates HOTP code and increments counter' ' [[ $("$PASS" otp uri passfile) == "$inc" ]] ' +test_expect_success 'HOTP counter increments and preserves multiline contents' ' + uri="otpauth://hotp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&counter=10&issuer=Example" + inc="otpauth://hotp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&counter=11&issuer=Example" + + read -r -d "" existing <<EOF +foo bar baz +zab rab oof +$uri1 +baz bar foo +EOF + + read -r -d "" expected <<EOF +foo bar baz +zab rab oof +$uri2 +baz bar foo +EOF + + test_pass_init && + "$PASS" insert -mf passfile <<< "$existing" && + "$PASS" otp code passfile && + [[ $("$PASS" show passfile) == "$expected" ]] +' + test_done |