1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#!/usr/bin/env bash
# shellcheck disable=SC2016,SC1091,SC2164
export test_description="Testing pass update."
cd tests
source ./commons
test_export "options"
test_pass_populate
test_expect_success 'Testing updating password with specific length' '
_pass update --force --length=50 France/bank &&
newpasswd="$(pass show France/bank | head -n 1)" &&
[[ "${#newpasswd}" == 50 ]]
'
test_expect_success 'Testing updating password with no symbols' '
_pass update --force --no-symbols Business/site.eu
'
test_expect_success 'Testing updating password with a provided password' '
echo -e "dummypass\ndummypass" | _pass update --force --provide Business/site.com &&
test_password_is Business/site.com dummypass
'
testing_password_notmatching() {
echo -e "pass\ndummypass" | _pass update --force --provide Business/site.com
}
test_expect_success 'Testing passwords not matching' '
test_must_fail testing_password_notmatching
'
test_expect_success 'Testing updating a multiline password' '
echo -e "dummypass\nlogin: dummylogin" | _pass update --force --multiline Business/site.eu &&
test_password_is Business/site.eu dummypass
'
test_expect_success 'Testing updating a password by editing it' "
_pass update --edit Business/site.eu &&
test_password_is Business/site.eu 'correct horse battery staple'
"
test_expect_success 'Testing updating a password with the same length' '
_pass update --force --auto-length Business/site.eu &&
newpasswd="$(pass show Business/site.eu | head -n 1)" &&
[[ "${#newpasswd}" == 28 ]]
'
if test_have_prereq XCLIP; then
test_expect_success 'Testing updating password with clipboard output' '
_pass update --force --clip Email/donenfeld.com &&
test_password_is_not Email/donenfeld.com $PASSWORD
'
fi
test_done
|