password-store

Simple password manager using gpg and ordinary unix directories
git clone https://git.zx2c4.com/password-store
Log | Files | Refs | README | LICENSE

t0400-grep.sh (1033B)


      1 #!/usr/bin/env bash
      2 
      3 test_description='Grep check'
      4 cd "$(dirname "$0")"
      5 . ./setup.sh
      6 
      7 test_expect_success 'Make sure grep prints normal lines' '
      8 	"$PASS" init $KEY1 &&
      9 	"$PASS" insert -e blah1 <<<"hello" &&
     10 	"$PASS" insert -e blah2 <<<"my name is" &&
     11 	"$PASS" insert -e folder/blah3 <<<"I hate computers" &&
     12 	"$PASS" insert -e blah4 <<<"me too!" &&
     13 	"$PASS" insert -e folder/where/blah5 <<<"They are hell" &&
     14 	results="$("$PASS" grep hell)" &&
     15 	[[ $(wc -l <<<"$results") -eq 4 ]] &&
     16 	grep -q blah5 <<<"$results" &&
     17 	grep -q blah1 <<<"$results" &&
     18 	grep -q "They are" <<<"$results"
     19 '
     20 
     21 test_expect_success 'Test passing the "-i" option to grep' '
     22 	"$PASS" init $KEY1 &&
     23 	"$PASS" insert -e blah1 <<<"I wonder..." &&
     24 	"$PASS" insert -e blah2 <<<"Will it ignore" &&
     25 	"$PASS" insert -e blah3 <<<"case when searching?" &&
     26 	"$PASS" insert -e folder/blah4 <<<"Yes, it does. Wonderful!" &&
     27 	results="$("$PASS" grep -i wonder)" &&
     28 	[[ $(wc -l <<<"$results") -eq 4 ]] &&
     29 	grep -q blah1 <<<"$results" &&
     30 	grep -q blah4 <<<"$results"
     31 '
     32 
     33 test_done