aboutsummaryrefslogtreecommitdiff
path: root/test/uri.t
blob: 084b0105c5a56576a893f18a6a680e2bd7343324 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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