pashage

Yet Another Opinionated Re-engineering of the Unix Password Store
git clone https://git.instinctive.eu/pashage.git
Log | Files | Refs | README | LICENSE

commit feab4850550c291c1aa9a4060b4512e8580320e5
parent 0280dc8e786ee3e467b64b101241c3a12fb7184a
Author: Natasha Kerensikova <natgh@instinctive.eu>
Date:   Sun, 27 Oct 2024 11:36:28 +0000

Status is explicitly tested in all cases
Diffstat:
Mspec/action_spec.sh | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mspec/internal_spec.sh | 22++++++++++++++++++++++
Mspec/pashage_extra_spec.sh | 1+
Mspec/pass_spec.sh | 86++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Mspec/scm_spec.sh | 18++++++++++++++++++
Mspec/usage_spec.sh | 81++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
6 files changed, 275 insertions(+), 2 deletions(-)

diff --git a/spec/action_spec.sh b/spec/action_spec.sh @@ -81,6 +81,7 @@ Describe 'Action Functions' #|$ scm_commit Move sub/secret.age to sub/renamed.age } When call do_copy_move sub/secret sub/renamed + The status should be success The output should be blank The error should equal "$(result)" End @@ -98,6 +99,7 @@ Describe 'Action Functions' #|$ scm_commit Copy root.age to sub/root.age } When call do_copy_move root sub/ + The status should be success The output should be blank The error should equal "$(result)" End @@ -115,6 +117,7 @@ Describe 'Action Functions' #|$ scm_commit Copy root.age to sub/moved.age } When call do_copy_move root.age sub/moved.age + The status should be success The output should be blank The error should equal "$(result)" End @@ -131,6 +134,7 @@ Describe 'Action Functions' #|$ scm_commit Copy root.age to sub/root.age } When call do_copy_move root sub/ + The status should be success The output should be blank The error should equal "$(result)" End @@ -144,6 +148,7 @@ Describe 'Action Functions' #|$ scm_commit Move notes.txt to sub/notes.txt } When call do_copy_move notes.txt sub/ + The status should be success The output should be blank The error should equal "$(result)" End @@ -158,6 +163,7 @@ Describe 'Action Functions' #|$ scm_commit Move notes.txt to sub/notes.txt } When call do_copy_move notes.txt sub/ + The status should be success The output should be blank The error should equal "$(result)" End @@ -170,6 +176,7 @@ Describe 'Action Functions' #|$ scm_commit Move sub/secret.age to subdir/secret.age } When call do_copy_move sub/secret subdir + The status should be success The output should be blank The error should equal "$(result)" End @@ -194,6 +201,7 @@ Describe 'Action Functions' #|$ scm_commit Move root.age to sub/secret.age } When call do_copy_move root sub/secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -206,6 +214,7 @@ Describe 'Action Functions' #|$ scm_commit Move sub/ to subdir/sub/ } When call do_copy_move sub subdir/ + The status should be success The output should be blank The error should equal "$(result)" End @@ -227,6 +236,7 @@ Describe 'Action Functions' #|$ scm_commit Move sub/bare/ to subdir/new-bare/ } When call do_copy_move sub/bare subdir/new-bare + The status should be success The output should be blank The error should equal "$(result)" End @@ -255,6 +265,7 @@ Describe 'Action Functions' #|$ scm_commit Copy sub/bare/ to subdir/new-bare/ } When call do_copy_move sub/bare subdir/new-bare + The status should be success The output should be blank The error should equal "$(result)" End @@ -310,6 +321,7 @@ Describe 'Action Functions' #|$ scm_mv root.age non-existent } When run do_copy_move_file root.age non-existent + The status should be success The output should be blank The error should equal "$(result)" End @@ -332,6 +344,7 @@ Describe 'Action Functions' IDENTITIES_FILE='/path/to/identity' When call do_decrypt '/path/to/encrypted/file.age' + The status should be success The output should equal 'cleartext' The error should equal \ '$ age -d -i /path/to/identity -- /path/to/encrypted/file.age' @@ -343,6 +356,7 @@ Describe 'Action Functions' unset GPG_AGENT_INFO unset GPG When call do_decrypt_gpg /path/to/encrypted/file.gpg + The status should be success The error should equal \ '$ gpg -d --quiet --yes --compress-algo=none --no-encrypt-to -- /path/to/encrypted/file.gpg' End @@ -352,6 +366,7 @@ Describe 'Action Functions' GPG_AGENT_INFO=agent-info unset GPG When call do_decrypt_gpg /path/to/encrypted/file.gpg + The status should be success The error should equal \ '$ gpg -d --quiet --yes --compress-algo=none --no-encrypt-to --batch --use-agent -- /path/to/encrypted/file.gpg' End @@ -361,6 +376,7 @@ Describe 'Action Functions' unset GPG_AGENT_INFO unset GPG When call do_decrypt_gpg /path/to/encrypted/file.gpg + The status should be success The error should equal \ '$ gpg2 -d --quiet --yes --compress-algo=none --no-encrypt-to --batch --use-agent -- /path/to/encrypted/file.gpg' End @@ -370,6 +386,7 @@ Describe 'Action Functions' unset GPG_AGENT_INFO GPG=user_cmd When call do_decrypt_gpg /path/to/encrypted/file.gpg + The status should be success The error should equal \ '$ user_cmd -d --quiet --yes --compress-algo=none --no-encrypt-to -- /path/to/encrypted/file.gpg' End @@ -413,6 +430,7 @@ Describe 'Action Functions' #|$ scm_commit Deinitialize store root } When call do_deinit '' + The status should be success The output should be blank The error should equal "$(result)" End @@ -426,6 +444,7 @@ Describe 'Action Functions' #|$ scm_commit Deinitialize sub } When call do_deinit sub + The status should be success The output should be blank The error should equal "$(result)" End @@ -439,6 +458,7 @@ Describe 'Action Functions' #|$ scm_commit Deinitialize sub } When call do_deinit sub + The status should be success The output should be blank The error should equal "$(result)" End @@ -489,6 +509,7 @@ Describe 'Action Functions' #|$ scm_commit Remove sub/entry from store. } When call do_delete sub/entry + The status should be success The output should be blank The error should equal "$(result)" End @@ -504,6 +525,7 @@ Describe 'Action Functions' #|$ yesno Are you sure you would like to delete sub/entry? } When call do_delete sub/entry + The status should be success The output should be blank The error should equal "$(result)" End @@ -516,6 +538,7 @@ Describe 'Action Functions' #|$ scm_commit Remove empty/ from store. } When call do_delete empty + The status should be success The output should equal 'Removing empty/' The error should equal "$(result)" End @@ -528,6 +551,7 @@ Describe 'Action Functions' #|$ scm_commit Remove sub from store. } When call do_delete sub + The status should be success The output should equal 'Removing sub' The error should equal "$(result)" End @@ -540,6 +564,7 @@ Describe 'Action Functions' #|$ scm_commit Remove sub/ from store. } When call do_delete sub/ + The status should be success The output should equal 'Removing sub/' The error should equal "$(result)" End @@ -652,6 +677,7 @@ Describe 'Action Functions' } EDIT_CMD=edit When call do_edit sub/new + The status should be success The output should be blank The error should equal "$(result)" End @@ -664,6 +690,7 @@ Describe 'Action Functions' } EDIT_CMD=true When call do_edit new + The status should be success The output should equal 'New password for new not saved.' The error should equal "$(result)" End @@ -687,6 +714,7 @@ Describe 'Action Functions' } EDIT_CMD=edit When call do_edit existing + The status should be success The output should be blank The error should equal "$(result)" End @@ -703,6 +731,7 @@ Describe 'Action Functions' } EDIT_CMD=true When call do_edit existing + The status should be success The output should equal 'Password for existing unchanged.' The error should equal "$(result)" End @@ -720,6 +749,7 @@ Describe 'Action Functions' #|$ edit ${SECURE_TMPDIR}/XXXXXX-subdir-new.txt } When call do_edit subdir/new + The status should be success The output should equal 'New password for subdir/new not saved.' The error should equal "$(result)" End @@ -737,6 +767,7 @@ Describe 'Action Functions' #|$ edit ${SECURE_TMPDIR}/XXXXXX-subdir-new.txt } When call do_edit subdir/new + The status should be success The output should equal 'New password for subdir/new not saved.' The error should equal "$(result)" End @@ -754,6 +785,7 @@ Describe 'Action Functions' #|$ edit ${SECURE_TMPDIR}/XXXXXX-subdir-new.txt } When call do_edit subdir/new + The status should be success The output should equal 'New password for subdir/new not saved.' The error should equal "$(result)" End @@ -771,6 +803,7 @@ Describe 'Action Functions' #|$ edit ${SECURE_TMPDIR}/XXXXXX-subdir-new.txt } When call do_edit subdir/new + The status should be success The output should equal 'New password for subdir/new not saved.' The error should equal "$(result)" End @@ -787,6 +820,7 @@ Describe 'Action Functions' #|$ vi ${SECURE_TMPDIR}/XXXXXX-subdir-new.txt } When call do_edit subdir/new + The status should be success The output should equal 'New password for subdir/new not saved.' The error should equal "$(result)" End @@ -836,6 +870,7 @@ Describe 'Action Functions' #|$ age -e -i /path/to/identity -o /prefix/encrypted/file.age } When run do_encrypt 'encrypted/file.age' + The status should be success The error should equal "$(result)" End @@ -853,6 +888,7 @@ Describe 'Action Functions' #|$ age -e -R /path/to/recipients -o ${PREFIX}/existing-file } When run do_encrypt 'existing-file' + The status should be success The error should equal "$(result)" The variable OVERWRITE should equal no End @@ -871,6 +907,7 @@ Describe 'Action Functions' #|$ age -e -R /path/to/recipients -o ${PREFIX}/existing-file } When run do_encrypt 'existing-file' + The status should be success The error should equal "$(result)" The variable OVERWRITE should equal yes End @@ -902,6 +939,7 @@ Describe 'Action Functions' } When call do_encrypt 'encrypted/file.age' + The status should be success The error should equal "$(result)" End End @@ -975,6 +1013,7 @@ Describe 'Action Functions' #|> 0123456789 } When call do_generate sub/new 10 '[alnum:]' + The status should be success The output should be blank The error should equal "$(result)" End @@ -997,6 +1036,7 @@ Describe 'Action Functions' #|> 0123456789 } When call do_generate sub/new 10 '[alnum:]' + The status should be success The output should equal \ '(B)The generated password for (U)sub/new(!U) is:(N)' The error should equal "$(result)" @@ -1017,6 +1057,7 @@ Describe 'Action Functions' #|> 0123456789 } When call do_generate existing 10 '[alnum:]' + The status should be success The output should be blank The error should equal "$(result)" End @@ -1041,6 +1082,7 @@ Describe 'Action Functions' #|> 0123456789 } When call do_generate existing 10 '[alnum:]' + The status should be success The output should be blank The error should equal "$(result)" The variable OVERWRITE should equal 'once' @@ -1060,6 +1102,7 @@ Describe 'Action Functions' #|$ yesno An entry already exists for existing. Overwrite it? } When call do_generate existing 10 '[alnum:]' + The status should be success The output should be blank The error should equal "$(result)" End @@ -1092,6 +1135,7 @@ Describe 'Action Functions' #|> 0123456789 } When call do_generate existing 10 '[alnum:]' + The status should be success The output should equal 'Decrypting previous secret for existing' The error should equal "$(result)" End @@ -1132,6 +1176,7 @@ Describe 'Action Functions' ( cd "${PREFIX}" && do_grep '' "$@" ) } When call start_do_grep ot + The status should be success The output should equal "$(result)" End End @@ -1163,6 +1208,7 @@ Describe 'Action Functions' #|$ scm_commit Set age recipients at store root } When call do_init '' identity + The status should be success The output should equal 'Password store recipients set at store root' The error should equal "$(result)" The file "${PREFIX}/.age-recipients" should be exist @@ -1185,6 +1231,7 @@ Describe 'Action Functions' #|identity 2 } When call do_init sub 'identity 1' 'identity 2' + The status should be success The output should equal 'Password store recipients set at sub' The error should equal "$(result)" The file "${PREFIX}/sub/.age-recipients" should be exist @@ -1202,6 +1249,7 @@ Describe 'Action Functions' #|$ scm_commit Set age recipients at store root } When call do_init '' identity + The status should be success The output should equal 'Password store recipients set at store root' The error should equal "$(result)" The file "${PREFIX}/.age-recipients" should be exist @@ -1258,6 +1306,7 @@ Describe 'Action Functions' End When call do_insert 'subdir/new' + The status should be success The output should equal 'Enter password for subdir/new: ' The error should equal "$(result)" End @@ -1283,6 +1332,7 @@ Describe 'Action Functions' End When call do_insert 'subdir/new' + The status should be success The output should equal \ 'Enter contents of subdir/new and press Ctrl+D when finished:' The error should equal "$(result)" @@ -1319,6 +1369,7 @@ Describe 'Action Functions' End When call do_insert 'subdir/new' + The status should be success The output should equal "$(o_result)" The error should equal "$(e_result)" End @@ -1343,6 +1394,7 @@ Describe 'Action Functions' Data 'password' When call do_insert 'existing' + The status should be success The output should equal \ 'Enter contents of existing and press Ctrl+D when finished:' The error should equal "$(result)" @@ -1363,6 +1415,7 @@ Describe 'Action Functions' Data 'password' When call do_insert 'existing' + The status should be success The output should be blank The error should equal "$(result)" End @@ -1386,6 +1439,7 @@ Describe 'Action Functions' Data 'password' When call do_insert 'existing' + The status should be success The output should equal \ 'Enter contents of existing and press Ctrl+D when finished:' The error should equal "$(result)" @@ -1429,6 +1483,7 @@ Describe 'Action Functions' It 'lists the whole store' When call do_list_or_show '' + The status should be success The output should be blank The error should equal "$ do_tree ${PREFIX} Password Store" End @@ -1440,6 +1495,7 @@ Describe 'Action Functions' #|$ do_show other/lower } When call do_list_or_show 'other/lower' + The status should be success The error should equal "$(result)" End @@ -1450,11 +1506,13 @@ Describe 'Action Functions' #|$ do_show subdir/subsub/old } When call do_list_or_show 'subdir/subsub/old' + The status should be success The error should equal "$(result)" End It 'lists a subdirectory' When call do_list_or_show 'subdir' + The status should be success The output should be blank The error should equal "$ do_tree ${PREFIX}/subdir subdir" End @@ -1509,6 +1567,7 @@ Describe 'Action Functions' #|$ scm_add subdir/subsub/deep.age } When call do_reencrypt subdir/subsub/deep + The status should be success The output should be blank The error should equal "$(result)" End @@ -1526,6 +1585,7 @@ Describe 'Action Functions' #|$ scm_add subdir/subsub/deep.age } When call do_reencrypt subdir/ + The status should be success The output should be blank The error should equal "$(result)" End @@ -1548,6 +1608,7 @@ Describe 'Action Functions' #|$ scm_add subdir/subsub/deep.age } When call do_reencrypt subdir + The status should be success The output should be blank The error should equal "$(result)" End @@ -1582,6 +1643,7 @@ Describe 'Action Functions' Data cleartext SHOW=text When call do_show + The status should be success The output should equal "$(cleartext)" End @@ -1594,6 +1656,7 @@ Describe 'Action Functions' SELECTED_LINE=1 SHOW=clip When call do_show title + The status should be success The output should be blank The error should equal 'password line' End @@ -1607,6 +1670,7 @@ Describe 'Action Functions' SELECTED_LINE=1 SHOW=qrcode When call do_show title + The status should be success The output should be blank The error should equal 'password line' End @@ -1661,6 +1725,7 @@ Describe 'Action Functions' #|____L_(R)old(N) } When call do_tree "${PREFIX}" 'Title' + The status should be success The output should equal "$(result)" End @@ -1675,6 +1740,7 @@ Describe 'Action Functions' #|____L_(R)old(N) } When call do_tree "${PREFIX}" 'Title' -i L + The status should be success The output should equal "$(result)" End @@ -1685,16 +1751,19 @@ Describe 'Action Functions' #|L_root } When call do_tree "${PREFIX}" 'Title' t + The status should be success The output should equal "$(result)" End It 'might not display anything' When call do_tree "${PREFIX}" 'Title' z + The status should be success The output should equal '' End It 'does not display an empty title' When call do_tree "${PREFIX}" '' t + The status should be success The output should equal 'L_root' End End diff --git a/spec/internal_spec.sh b/spec/internal_spec.sh @@ -26,24 +26,28 @@ Describe 'Internal Helper Functions' Describe 'check_sneaky_path' It 'accept an empty path' When run check_sneaky_path '' + The status should be success The error should be blank The output should be blank End It 'accepts a file name' When run check_sneaky_path 'a' + The status should be success The error should be blank The output should be blank End It 'accepts an absolute path' When run check_sneaky_path '/a/b/c' + The status should be success The error should be blank The output should be blank End It 'accepts a relative path' When run check_sneaky_path 'a/b/c/' + The status should be success The error should be blank The output should be blank End @@ -87,12 +91,14 @@ Describe 'Internal Helper Functions' It 'accepts several good paths' When run check_sneaky_paths a b/c /d/e/f + The status should be success The error should be blank The output should be blank End It 'accepts an empty argument list' When run check_sneaky_paths + The status should be success The error should be blank The output should be blank End @@ -117,6 +123,7 @@ Describe 'Internal Helper Functions' It 'continues silently when the command is successful' When run checked echo_ret 'it runs' 0 + The status should be success The output should equal 'it runs' The error should be blank End @@ -132,11 +139,13 @@ Describe 'Internal Helper Functions' Describe 'glob_exists' It 'answers y when the glob matches something' When call glob_exists /* + The status should be success The variable ANSWER should equal y End It 'answers n when the glob does not match anything' When call glob_exists non-existent/* + The status should be success The variable ANSWER should equal n End End @@ -156,24 +165,28 @@ Describe 'Internal Helper Functions' It 'returns root from root' When call set_LOCAL_RECIPIENT_FILE foo + The status should be success The variable LOCAL_RECIPIENT_FILE should equal \ "${PREFIX}/.age-recipients" End It 'returns root from unmarked subdirectory' When call set_LOCAL_RECIPIENT_FILE special/foo + The status should be success The variable LOCAL_RECIPIENT_FILE should equal \ "${PREFIX}/.age-recipients" End It 'returns subdirectory from itself' When call set_LOCAL_RECIPIENT_FILE subdir/foo + The status should be success The variable LOCAL_RECIPIENT_FILE should equal \ "${PREFIX}/subdir/.age-recipients" End It 'returns subdirectory from sub-subdirectory' When call set_LOCAL_RECIPIENT_FILE subdir/subsub/foo + The status should be success The variable LOCAL_RECIPIENT_FILE should equal \ "${PREFIX}/subdir/.age-recipients" End @@ -186,22 +199,26 @@ Describe 'Internal Helper Functions' It 'returns nothing from empty root' When call set_LOCAL_RECIPIENT_FILE foo + The status should be success The variable LOCAL_RECIPIENT_FILE should equal '' End It 'returns nothing from unmarked subdirectory below empty root' When call set_LOCAL_RECIPIENT_FILE special/foo + The status should be success The variable LOCAL_RECIPIENT_FILE should equal '' End It 'returns subdirectory from itself even under empty root' When call set_LOCAL_RECIPIENT_FILE subdir/foo + The status should be success The variable LOCAL_RECIPIENT_FILE should equal \ "${PREFIX}/subdir/.age-recipients" End It 'returns subdirectory from sub-subdirectory even under empty root' When call set_LOCAL_RECIPIENT_FILE subdir/subsub/foo + The status should be success The variable LOCAL_RECIPIENT_FILE should equal \ "${PREFIX}/subdir/.age-recipients" End @@ -224,6 +241,7 @@ Describe 'Internal Helper Functions' It 'accepts an uppercase N' Data 'N' When call yesno 'prompt' + The status should be success The output should equal 'prompt [y/n]' The variable ANSWER should equal 'N' End @@ -231,6 +249,7 @@ Describe 'Internal Helper Functions' It 'accepts an uppercase Y' Data 'YES' When call yesno 'prompt' + The status should be success The output should equal 'prompt [y/n]' The variable ANSWER should equal 'y' End @@ -242,6 +261,7 @@ Describe 'Internal Helper Functions' It 'accepts a lowercase N' Data 'no' When call yesno 'prompt' + The status should be success The output should equal 'prompt [y/n]' The variable ANSWER should equal 'n' End @@ -249,6 +269,7 @@ Describe 'Internal Helper Functions' It 'accepts an uppercase Y' Data 'Y' When call yesno 'prompt' + The status should be success The output should equal 'prompt [y/n]' The variable ANSWER should equal 'y' End @@ -272,6 +293,7 @@ Describe 'Internal Helper Functions' It 'accepts a lowercase Y after bad input' When call yesno 'prompt' + The status should be success The output should equal 'prompt [y/n]' The variable ANSWER should equal 'y' End diff --git a/spec/pashage_extra_spec.sh b/spec/pashage_extra_spec.sh @@ -162,6 +162,7 @@ Describe 'Integrated Command Functions' #|y End When call cmd_delete stale subdir/file fluff/two + The status should be success The output should equal 'Are you sure you would like to delete stale? [y/n]Are you sure you would like to delete subdir/file? [y/n]Are you sure you would like to delete fluff/two? [y/n]' The error should be blank The file "${PREFIX}/fluff/two.age" should not be exist diff --git a/spec/pass_spec.sh b/spec/pass_spec.sh @@ -314,6 +314,7 @@ Describe 'Pass-like command' Skip if 'pass(age) needs bash' check_skip $2 Skip if 'passage has no init' [ "$2" = passage ] When run script $1 init 'new-id' + The status should be success The output should include 'Password store' expected_log() { if [ "$2" = pashage ]; then @@ -352,6 +353,7 @@ Describe 'Pass-like command' Skip if 'pass(age) needs bash' check_skip $2 Skip if 'passage has no init' [ "$2" = passage ] When run script $1 init -p subdir 'new-id' + The status should be success The output should start with 'Password store' The output should include 'subdir' expected_log() { @@ -383,6 +385,7 @@ Describe 'Pass-like command' Skip if 'pass(age) needs bash' check_skip $2 Skip if 'passage has no init' [ "$2" = passage ] When run script $1 init -p fluff 'new-id' 'new-master' + The status should be success The output should start with 'Password store' The output should include 'fluff' expected_log() { @@ -516,6 +519,7 @@ Describe 'Pass-like command' It 'lists a directory' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 ls subdir + The status should be success The line 1 of output should include 'subdir' The line 2 of output should include 'file' End @@ -523,6 +527,7 @@ Describe 'Pass-like command' It 'lists a directory implicitly' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 subdir + The status should be success The line 1 of output should include 'subdir' The line 2 of output should include 'file' End @@ -530,6 +535,7 @@ Describe 'Pass-like command' It 'lists a directory when called as `show`' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 show subdir + The status should be success The line 1 of output should include 'subdir' The line 2 of output should include 'file' End @@ -537,6 +543,7 @@ Describe 'Pass-like command' It 'lists the whole store without argument' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 + The status should be success if [ $2 = passage ]; then The line 1 of output should equal 'Passage' else @@ -580,6 +587,7 @@ Describe 'Pass-like command' It 'lists a directory having an ambiguous name with `/` suffix' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 extra/ + The status should be success The line 1 of output should include 'extra' The line 2 of output should include 'subdir' The line 3 of output should include 'file' @@ -618,6 +626,7 @@ Describe 'Pass-like command' It 'lists entries matching a substring' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 find o + The status should be success The lines of output should equal 6 The line 1 of output should match pattern 'Search *: o' The line 2 of output should include 'fluff' @@ -652,12 +661,14 @@ Describe 'Pass-like command' It 'decrypts a password file' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 show subdir/file + The status should be success The output should equal 'p4ssw0rd' End It 'decrypts a password file implicitly' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 subdir/file + The status should be success The output should equal 'p4ssw0rd' End @@ -672,18 +683,21 @@ Describe 'Pass-like command' It 'decrypts a password file named like a flag' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 -- -g + The status should be success The output should equal '--' End It 'decrypts a password file even when called as `list`' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 ls subdir/file + The status should be success The output should equal 'p4ssw0rd' End It 'decrypts a file having an ambiguous name without suffix' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 extra + The status should be success The output should equal 'ambiguous' End @@ -691,6 +705,7 @@ Describe 'Pass-like command' DISPLAY=mock Skip if 'pass(age) needs bash' check_skip $2 When run script $1 -q fluff/one + The status should be success expected_err() { %text:expand #|$ feh -x --title ${1}: fluff/one -g +200+200 - #|0000000 31 2d 70 61 73 73 77 6f 72 64 @@ -707,6 +722,7 @@ Describe 'Pass-like command' DISPLAY=mock Skip if 'pass(age) needs bash' check_skip $2 When run script $1 --qrcode=2 fluff/three + The status should be success expected_err() { %text:expand #|$ feh -x --title ${1}: fluff/three -g +200+200 - #|0000000 55 73 65 72 6e 61 6d 65 3a 20 33 4a 61 6e 65 @@ -723,6 +739,7 @@ Describe 'Pass-like command' DISPLAY=mock Skip if 'pass(age) needs bash' check_skip $2 When run script $1 show -c fluff/three + The status should be success The output should start with \ 'Copied fluff/three to clipboard. Will clear in 45 seconds.' expected_err() { %text @@ -737,6 +754,7 @@ Describe 'Pass-like command' DISPLAY=mock Skip if 'pass(age) needs bash' check_skip $2 When run script $1 show -c2 fluff/three + The status should be success The output should start with \ 'Copied fluff/three to clipboard. Will clear in 45 seconds.' expected_err() { %text @@ -779,6 +797,7 @@ Describe 'Pass-like command' It 'shows decrypted lines matching a regex' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 grep -i Com + The status should be success The lines of output should equal 4 The line 1 of output should include 'fluff' The output should include 'three' @@ -823,6 +842,7 @@ Describe 'Pass-like command' #|URL: https://example.com/login End When run script $1 insert -m rootpass + The status should be success The output should include 'rootpass' The contents of file "${PREFIX}/rootpass.$3" \ should include "$3:Username: tester" @@ -844,6 +864,7 @@ Describe 'Pass-like command' #|pass-word End When run script $1 insert newdir/newpass + The status should be success The output should include 'newdir/newpass' The contents of file "${PREFIX}/newdir/newpass.$3" \ should include "$3:pass-word" @@ -875,6 +896,7 @@ Describe 'Pass-like command' #|pass-word End When run script $1 insert -- -h + The status should be success The output should include '-h' The contents of file "${PREFIX}/-h.$3" \ should include "$3:pass-word" @@ -893,6 +915,7 @@ Describe 'Pass-like command' Skip if 'pass(age) needs bash' check_skip $2 Data "pass-word" When run script $1 insert -e newdir/newpass + The status should be success The output should include 'newdir/newpass' The output should not include 'Retype' The contents of file "${PREFIX}/newdir/newpass.$3" \ @@ -912,6 +935,7 @@ Describe 'Pass-like command' Skip if 'pass(age) needs bash' check_skip $2 Data "passWord" When run script $1 insert -e shared/newpass + The status should be success The output should include 'shared/newpass' The contents of file "${PREFIX}/shared/newpass.$3" \ should include 'friend' @@ -934,6 +958,7 @@ Describe 'Pass-like command' Skip if 'pass(age) needs bash' check_skip $2 Data "pass-word" When run script $1 insert -e -f subdir/file + The status should be success The output should include 'subdir/file' The output should not include 'Retype' The contents of file "${PREFIX}/subdir/file.$3" \ @@ -953,6 +978,7 @@ Describe 'Pass-like command' Skip if 'pass(age) needs bash' check_skip $2 Data "drowssap" When run script $1 insert -e new-dir/newpass + The status should be success The output should include 'new-dir/newpass' The contents of file "${PREFIX}/new-dir/newpass.$3" \ should include 'myself' @@ -1008,6 +1034,7 @@ Describe 'Pass-like command' #|wq End When run script $1 edit subdir/new + The status should be success The file "${PREFIX}/subdir/new.$3" should be exist expected_file() { %text:expand #|$1Recipient:myself @@ -1037,6 +1064,7 @@ Describe 'Pass-like command' #|wq End When run script $1 edit new-subdir/new + The status should be success The directory "${PREFIX}/new-subdir" should be exist The file "${PREFIX}/new-subdir/new.$3" should be exist expected_file() { %text:expand @@ -1066,6 +1094,7 @@ Describe 'Pass-like command' #|wq End When run script $1 edit -h + The status should be success The file "${PREFIX}/-h.$3" should be exist expected_file() { %text:expand #|$1Recipient:myself @@ -1094,6 +1123,7 @@ Describe 'Pass-like command' #|wq End When run script $1 edit fluff + The status should be success The file "${PREFIX}/fluff.$3" should be exist expected_file() { %text:expand #|$1Recipient:myself @@ -1122,6 +1152,7 @@ Describe 'Pass-like command' #|wq End When run script $1 edit y.txt + The status should be success The file "${PREFIX}/y.txt.$3" should be exist expected_file() { %text:expand #|$1Recipient:myself @@ -1149,6 +1180,7 @@ Describe 'Pass-like command' #|wq End When run script $1 edit fluff/two + The status should be success expected_file() { %text:expand #|$1Recipient:master #|$1Recipient:myself @@ -1178,6 +1210,7 @@ Describe 'Pass-like command' #|wq End When run script $1 edit extra + The status should be success expected_file() { %text:expand #|$1Recipient:myself #|$1:New line @@ -1205,6 +1238,7 @@ Describe 'Pass-like command' #|wq End When run script $1 edit stale + The status should be success expected_file() { %text:expand #|$1Recipient:myself #|$1:0-password @@ -1227,6 +1261,8 @@ Describe 'Pass-like command' Skip if 'pass(age) needs bash' check_skip $2 Data 'q' When run script $1 edit stale + The status should equal \ + "$(if [ $2 = pashage ]; then echo 0; else echo 1; fi)" expected_file() { %text:expand #|$1Recipient:master #|$1Recipient:myself @@ -1276,6 +1312,7 @@ Describe 'Pass-like command' It 'generates a new file' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 generate newdir/newfile + The status should be success The output should include 'The generated password for' The file "${PREFIX}/newdir/newfile.$3" should be exist The lines of contents of file "${PREFIX}/newdir/newfile.$3" should \ @@ -1308,6 +1345,7 @@ Describe 'Pass-like command' It 'generates a new file named like a flag' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 generate -- -h + The status should be success The output should include 'The generated password for' The file "${PREFIX}/-h.$3" should be exist The lines of contents of file "${PREFIX}/-h.$3" should equal 2 @@ -1329,6 +1367,7 @@ Describe 'Pass-like command' It 'generates a new file named like a directory' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 generate fluff + The status should be success The output should include 'The generated password for' The file "${PREFIX}/fluff.$3" should be exist The lines of contents of file "${PREFIX}/fluff.$3" should equal 2 @@ -1350,6 +1389,7 @@ Describe 'Pass-like command' It 'generates a new file in a new directory' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 generate brand-new-dir/file + The status should be success The output should include 'The generated password for' The file "${PREFIX}/brand-new-dir/file.$3" should be exist The lines of contents of file "${PREFIX}/brand-new-dir/file.$3" should \ @@ -1372,6 +1412,7 @@ Describe 'Pass-like command' It 'generates a new file without symbols' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 generate -n newfile 4 + The status should be success The output should include 'The generated password for' The file "${PREFIX}/newfile.$3" should be exist The lines of contents of file "${PREFIX}/newfile.$3" should \ @@ -1396,6 +1437,7 @@ Describe 'Pass-like command' It 'replaces an existing file when forced' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 generate -f fluff/three 20 + The status should be success The output should include 'The generated password for' The lines of contents of file "${PREFIX}/fluff/three.$3" should equal 3 The output should \ @@ -1414,6 +1456,7 @@ Describe 'Pass-like command' It 'replaces the first line of an existing file' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 generate -ni fluff/three 4 + The status should be success The output should include 'The generated password for' The lines of contents of file "${PREFIX}/fluff/three.$3" should equal 5 The line 3 of contents of file "${PREFIX}/fluff/three.$3" should \ @@ -1435,6 +1478,7 @@ Describe 'Pass-like command' DISPLAY=mock Skip if 'pass(age) needs bash' check_skip $2 When run script $1 generate -nc subdir/new + The status should be success The output should not include 'The generated password for' The output should not \ include "$(@sed -n "2s/$3://p" "${PREFIX}/subdir/new.$3")" @@ -1456,6 +1500,7 @@ Describe 'Pass-like command' DISPLAY=mock Skip if 'pass(age) needs bash' check_skip $2 When run script $1 generate -qn new + The status should be success The output should not include 'The generated password for' The output should not include "$(@sed -n "2s/$3://p" "${PREFIX}/new.$3")" The error should start with '$ feh -x --title pas' @@ -1498,6 +1543,7 @@ Describe 'Pass-like command' It 'removes a file without confirmation when forced' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 rm -f subdir/file + The status should be success The output should include 'subdir/file' The error should be blank The file "${PREFIX}/subdir/file.$3" should not be exist @@ -1525,6 +1571,7 @@ Describe 'Pass-like command' It 'removes a file named like a flag' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 rm -f -- -g + The status should be success The output should include '-g' The error should be blank The file "${PREFIX}/-g.$3" should not be exist @@ -1542,6 +1589,7 @@ Describe 'Pass-like command' It 'removes a file having an ambiguous name without suffix' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 rm -f extra + The status should be success The output should include 'extra' The error should be blank The file "${PREFIX}/extra.$3" should not be exist @@ -1569,6 +1617,8 @@ Describe 'Pass-like command' It 'does not remove a directory without `-r` even when forced' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 rm -f fluff + The status should equal \ + "$(if [ $2 = pashage ]; then echo 1; else echo 0; fi)" The error should include 'fluff/' The error should include 's a directory' The directory "${PREFIX}/fluff" should be exist @@ -1580,6 +1630,7 @@ Describe 'Pass-like command' It 'removes a directory when forced and recursive' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 rm -rf fluff + The status should be success The directory "${PREFIX}/fluff" should not be exist expected_log() { %text:expand #|Remove fluff/ from store. @@ -1602,6 +1653,7 @@ Describe 'Pass-like command' It 'removes a directory having an ambiguous name with `/` suffix' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 rm -rf extra/ + The status should be success The output should include 'extra' The error should be blank The file "${PREFIX}/extra.age" should be exist @@ -1622,6 +1674,8 @@ Describe 'Pass-like command' It 'does not remove anything with `/` suffix but no recursive flag' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 rm -f extra/ + The status should equal \ + "$(if [ $2 = pashage ]; then echo 1; else echo 0; fi)" The error should include 'extra/' The error should include 's a directory' The directory "${PREFIX}/extra" should be exist @@ -1690,6 +1744,7 @@ Describe 'Pass-like command' It 'renames a file without reencrypting' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 mv subdir/file subdir/renamed + The status should be success The error should be blank The file "${PREFIX}/subdir/file.$3" should not be exist file_contents() { %text:expand @@ -1727,6 +1782,7 @@ Describe 'Pass-like command' It 'renames a file named like a flag' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 mv -- -g -h + The status should be success The error should be blank The file "${PREFIX}/-g.$3" should not be exist file_contents() { %text:expand @@ -1754,6 +1810,7 @@ Describe 'Pass-like command' It 'reencrypts a moved file' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 mv subdir/file shared/renamed + The status should be success The error should be blank The file "${PREFIX}/subdir/file.$3" should not be exist file_contents() { %text:expand @@ -1782,6 +1839,7 @@ Describe 'Pass-like command' It 'moves an unencrypted file without reencrypting it' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 mv y.txt shared + The status should be success The error should be blank The file "${PREFIX}/y.txt" should not be exist file_contents() { %text @@ -1810,6 +1868,7 @@ Describe 'Pass-like command' It 'reencrypts relevant files in a moved directory' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 mv subdir shared/ + The status should be success The error should be blank The file "${PREFIX}/subdir/file.$3" should not be exist file_contents() { %text:expand @@ -1847,6 +1906,7 @@ Describe 'Pass-like command' It 'moves a file into a new directory' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 mv subdir/file new-subdir/ + The status should be success The error should be blank The file "${PREFIX}/subdir/file.$3" should not be exist file_contents() { %text:expand @@ -1884,6 +1944,7 @@ Describe 'Pass-like command' It 'renames a directory with recipients' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 mv fluff filler + The status should be success The error should be blank The directory "${PREFIX}/fluff" should not be exist The directory "${PREFIX}/filler" should be exist @@ -1913,6 +1974,7 @@ Describe 'Pass-like command' It 'renames a directory without recipients' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 mv subdir newdir + The status should be success The error should be blank The directory "${PREFIX}/subdir" should not be exist file_contents() { %text:expand @@ -1941,6 +2003,7 @@ Describe 'Pass-like command' It 'overwrites an existing file when forced' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 mv -f fluff/two fluff/one + The status should be success The file "${PREFIX}/fluff/two.$3" should not be exist file_contents() { %text:expand #|${1}Recipient:master @@ -1970,6 +2033,7 @@ Describe 'Pass-like command' It 'renames a file having an ambiguous name without suffix' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 mv extra new + The status should be success The file "${PREFIX}/extra.$3" should not be exist file_contents() { %text:expand #|${1}Recipient:myself @@ -1996,6 +2060,7 @@ Describe 'Pass-like command' It 'renames a directory having an ambiguous name with `/` suffix' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 mv extra/ new + The status should be success The directory "${PREFIX}/extra" should not be exist The file "${PREFIX}/new/subdir/file.age" should be exist The file "${PREFIX}/new/subdir/file.gpg" should be exist @@ -2019,6 +2084,7 @@ Describe 'Pass-like command' It 'moves a file to a directory having an ambiguous name without suffix' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 mv subdir/file extra + The status should be success The file "${PREFIX}/subdir/file.$3" should not be exist file_contents() { %text:expand #|${1}Recipient:myself @@ -2045,6 +2111,7 @@ Describe 'Pass-like command' It 'does not merge directories recursively' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 mv -f subdir/ extra/ + The status should equal 1 The error should include 'subdir' The error should include 'extra/' The directory "${PREFIX}/subdir" should be exist @@ -2109,6 +2176,7 @@ Describe 'Pass-like command' It 'copies a file without reencrypting' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 cp subdir/file subdir/copy + The status should be success The error should be blank file_contents() { %text:expand #|${1}Recipient:myself @@ -2145,6 +2213,7 @@ Describe 'Pass-like command' It 'copies a file named like a flag' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 cp -- -g -h + The status should be success The error should be blank file_contents() { %text:expand #|${1}Recipient:myself @@ -2171,6 +2240,7 @@ Describe 'Pass-like command' It 'reencrypts a copied file' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 cp subdir/file shared/copy + The status should be success The error should be blank file_contents() { %text:expand #|${1}Recipient:myself @@ -2198,6 +2268,7 @@ Describe 'Pass-like command' It 'copies an unencrypted file without reencrypting it' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 cp y.txt shared + The status should be success The error should be blank file_contents() { %text #|Unencrypted line 1 @@ -2225,6 +2296,7 @@ Describe 'Pass-like command' It 'reencrypts relevant files in a copied directory' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 cp subdir shared/ + The status should be success The error should be blank file_contents() { %text:expand #|${1}Recipient:myself @@ -2261,6 +2333,7 @@ Describe 'Pass-like command' It 'copies a file into a new directory' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 cp subdir/file new-subdir/ + The status should be success The error should be blank file_contents() { %text:expand #|${1}Recipient:myself @@ -2297,6 +2370,7 @@ Describe 'Pass-like command' It 'copies a directory with recipients' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 cp fluff filler + The status should be success The error should be blank The directory "${PREFIX}/filler" should be exist expected_log() { @@ -2325,6 +2399,7 @@ Describe 'Pass-like command' It 'copies a directory without recipients' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 cp subdir newdir + The status should be success The error should be blank file_contents() { %text:expand #|${1}Recipient:myself @@ -2352,6 +2427,7 @@ Describe 'Pass-like command' It 'overwrites an existing file when forced' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 cp -f fluff/two fluff/one + The status should be success file_contents() { %text:expand #|${1}Recipient:master #|${1}Recipient:myself @@ -2379,6 +2455,7 @@ Describe 'Pass-like command' It 'overwrites collisions when copying recursively and forcefully' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 cp -f subdir/ extra/ + The status should be success expected_log() { if [ "$2" = pashage ]; then %putsn 'Copy subdir/ to extra/subdir/' @@ -2399,6 +2476,7 @@ Describe 'Pass-like command' It 'copies a file having an ambiguous name without suffix' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 cp extra new + The status should be success file_contents() { %text:expand #|${1}Recipient:myself #|${1}:ambiguous @@ -2424,6 +2502,7 @@ Describe 'Pass-like command' It 'copies a directory having an ambiguous name with `/` suffix' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 cp extra/ new + The status should be success file_contents() { %text:expand #|${1}Recipient:myself #|${1}:Pa55worD @@ -2450,6 +2529,7 @@ Describe 'Pass-like command' It 'copies a file to a directory having an ambiguous name without suffix' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 cp subdir/file extra + The status should be success file_contents() { %text:expand #|${1}Recipient:myself #|${1}:p4ssw0rd @@ -2525,13 +2605,15 @@ Describe 'Pass-like command' It 'transmits arguments to git' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 git log --format='%s' --stat + The status should be success The output should equal "$(setup_log)" End It 'displays git usage when called without argument' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 git - # The status is success for pass(age) but 1 (from git) for pashage + The status should equal \ + "$(if [ $2 = pashage ]; then echo 1; else echo 0; fi)" The output should include 'usage: git' The error should be blank The result of function git_log should be successful @@ -2566,6 +2648,7 @@ Describe 'Pass-like command' It 'displays a help text with supported commands' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 help + The status should be success if ! [ $2 = passage ]; then The output should include ' init ' fi @@ -2585,6 +2668,7 @@ Describe 'Pass-like command' It 'displays a version box' Skip if 'pass(age) needs bash' check_skip $2 When run script $1 version + The status should be success The output should include 'password manager' The output should start with '=============' The output should end with '=============' diff --git a/spec/scm_spec.sh b/spec/scm_spec.sh @@ -58,6 +58,7 @@ Describe 'Integrated SCM Functions' scm_add untracked.txt } When call testcase + The status should be success The output should be blank The result of function git_status should be successful The contents of file "${SHELLSPEC_WORKDIR}/git-status.txt" \ @@ -70,6 +71,7 @@ Describe 'Integrated SCM Functions' scm_add subdir/file.txt } When call testcase + The status should be success The output should be blank The result of function git_status should be successful The contents of file "${SHELLSPEC_WORKDIR}/git-status.txt" \ @@ -159,6 +161,7 @@ Describe 'Integrated SCM Functions' It 'creates and adds a file' When call scm_cp subdir/file.txt file-copy.txt + The status should be success The output should be blank The contents of file "${PREFIX}/subdir/file.txt" should equal 'data' The contents of file "${PREFIX}/file-copy.txt" should equal 'data' @@ -169,6 +172,7 @@ Describe 'Integrated SCM Functions' It 'copies and adds a directory recursively' When call scm_cp subdir newdir + The status should be success The output should be blank The contents of file "${PREFIX}/subdir/file.txt" should equal 'data' The contents of file "${PREFIX}/newdir/file.txt" should equal 'data' @@ -183,6 +187,7 @@ Describe 'Integrated SCM Functions' It 'deletes a file' When call scm_del subdir/file.txt + The status should be success The output should be blank The file "${PREFIX}/subdir/file.txt" should not be exist The result of function git_status should be successful @@ -192,6 +197,7 @@ Describe 'Integrated SCM Functions' It 'deletes a directory recursively' When call scm_del subdir + The status should be success The output should be blank The directory "${PREFIX}/subdir" should not be exist The result of function git_status should be successful @@ -205,6 +211,7 @@ Describe 'Integrated SCM Functions' It 'moves a file and records the move' When call scm_mv subdir/file.txt file.txt + The status should be success The output should be blank The file "${PREFIX}/subdir/file.txt" should not be exist The contents of file "${PREFIX}/file.txt" should equal 'data' @@ -215,6 +222,7 @@ Describe 'Integrated SCM Functions' It 'moves a directory recursively and records the move' When call scm_mv subdir newdir + The status should be success The output should be blank The directory "${PREFIX}/subdir" should not be exist The contents of file "${PREFIX}/newdir/file.txt" should equal 'data' @@ -229,6 +237,7 @@ Describe 'Integrated SCM Functions' It 'removes a file' When call scm_rm subdir/file.txt + The status should be success The output should be blank The file "${PREFIX}/subdir/file.txt" should not be exist The result of function git_status should be successful @@ -238,6 +247,7 @@ Describe 'Integrated SCM Functions' It 'removes a directory recursively' When call scm_rm subdir + The status should be success The output should be blank The directory "${PREFIX}/subdir" should not be exist The result of function git_status should be successful @@ -309,6 +319,7 @@ Describe 'Integrated SCM Functions without SCM' It 'creates a file' When call scm_cp subdir/file.txt file-copy.txt + The status should be success The output should be blank The contents of file "${PREFIX}/subdir/file.txt" should equal 'data' The contents of file "${PREFIX}/file-copy.txt" should equal 'data' @@ -316,6 +327,7 @@ Describe 'Integrated SCM Functions without SCM' It 'copies a directory recursively' When call scm_cp subdir newdir + The status should be success The output should be blank The contents of file "${PREFIX}/subdir/file.txt" should equal 'data' The contents of file "${PREFIX}/newdir/file.txt" should equal 'data' @@ -325,12 +337,14 @@ Describe 'Integrated SCM Functions without SCM' Describe 'scm_del' It 'does nothing with a file' When call scm_del subdir/file.txt + The status should be success The output should be blank The contents of file "${PREFIX}/subdir/file.txt" should equal 'data' End It 'does nothing with a directory' When call scm_del subdir + The status should be success The output should be blank The contents of file "${PREFIX}/subdir/file.txt" should equal 'data' End @@ -341,6 +355,7 @@ Describe 'Integrated SCM Functions without SCM' It 'moves a file' When call scm_mv subdir/file.txt file.txt + The status should be success The output should be blank The file "${PREFIX}/subdir/file.txt" should not be exist The contents of file "${PREFIX}/file.txt" should equal 'data' @@ -348,6 +363,7 @@ Describe 'Integrated SCM Functions without SCM' It 'moves a directory recursively' When call scm_mv subdir newdir + The status should be success The output should be blank The directory "${PREFIX}/subdir" should not be exist The contents of file "${PREFIX}/newdir/file.txt" should equal 'data' @@ -359,12 +375,14 @@ Describe 'Integrated SCM Functions without SCM' It 'removes a file' When call scm_rm subdir/file.txt + The status should be success The output should be blank The file "${PREFIX}/subdir/file.txt" should not be exist End It 'removes a directory recursively' When call scm_rm subdir + The status should be success The output should be blank The directory "${PREFIX}/subdir" should not be exist End diff --git a/spec/usage_spec.sh b/spec/usage_spec.sh @@ -169,6 +169,7 @@ Describe 'Command-Line Parsing' #|SCM_ACTION=scm_cp } When call cmd_copy src1 src2 src3 dest + The status should be success The output should be blank The error should equal "$(result)" End @@ -185,6 +186,7 @@ Describe 'Command-Line Parsing' #|SCM_ACTION=scm_cp } When call cmd_copy --force src dest + The status should be success The output should be blank The error should equal "$(result)" End @@ -201,6 +203,7 @@ Describe 'Command-Line Parsing' #|SCM_ACTION=scm_cp } When call cmd_copy -f src dest + The status should be success The output should be blank The error should equal "$(result)" End @@ -217,6 +220,7 @@ Describe 'Command-Line Parsing' #|SCM_ACTION=scm_cp } When call cmd_copy -- -s dest + The status should be success The output should be blank The error should equal "$(result)" End @@ -267,6 +271,7 @@ Describe 'Command-Line Parsing' #|RECURSIVE=no } When call cmd_delete --force arg1 + The status should be success The output should be blank The error should equal "$(result)" End @@ -280,6 +285,7 @@ Describe 'Command-Line Parsing' #|RECURSIVE=no } When call cmd_delete -f arg1 + The status should be success The output should be blank The error should equal "$(result)" End @@ -293,6 +299,7 @@ Describe 'Command-Line Parsing' #|RECURSIVE=yes } When call cmd_delete --recursive arg1 + The status should be success The output should be blank The error should equal "$(result)" End @@ -306,6 +313,7 @@ Describe 'Command-Line Parsing' #|RECURSIVE=yes } When call cmd_delete -r arg1 + The status should be success The output should be blank The error should equal "$(result)" End @@ -319,6 +327,7 @@ Describe 'Command-Line Parsing' #|RECURSIVE=yes } When call cmd_delete --recursive --force arg1 + The status should be success The output should be blank The error should equal "$(result)" End @@ -332,6 +341,7 @@ Describe 'Command-Line Parsing' #|RECURSIVE=yes } When call cmd_delete -rf arg1 + The status should be success The output should be blank The error should equal "$(result)" End @@ -345,6 +355,7 @@ Describe 'Command-Line Parsing' #|RECURSIVE=yes } When call cmd_delete -fr arg1 + The status should be success The output should be blank The error should equal "$(result)" End @@ -366,6 +377,7 @@ Describe 'Command-Line Parsing' #|RECURSIVE=no } When call cmd_delete arg1 arg2 arg3 + The status should be success The output should be blank The error should equal "$(result)" End @@ -383,6 +395,7 @@ Describe 'Command-Line Parsing' #|RECURSIVE=no } When call cmd_delete -- -f arg2 + The status should be success The output should be blank The error should equal "$(result)" End @@ -435,6 +448,7 @@ Describe 'Command-Line Parsing' #|VISUAL=vi } When call cmd_edit arg1 arg2 arg3 + The status should be success The output should be blank The error should equal "$(result)" End @@ -453,6 +467,7 @@ Describe 'Command-Line Parsing' It 'uses the argument list directly' When call cmd_find -i pattern + The status should be success The output should equal 'Search pattern: -i pattern' The error should equal '$ do_tree /prefix -i pattern' End @@ -486,6 +501,7 @@ Describe 'Command-Line Parsing' #|SHOW=text } When call cmd_generate secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -501,6 +517,7 @@ Describe 'Command-Line Parsing' #|SHOW=text } When call cmd_generate secret 12 + The status should be success The output should be blank The error should equal "$(result)" End @@ -516,6 +533,7 @@ Describe 'Command-Line Parsing' #|SHOW=text } When call cmd_generate -- -f + The status should be success The output should be blank The error should equal "$(result)" End @@ -531,6 +549,7 @@ Describe 'Command-Line Parsing' #|SHOW=clip } When call cmd_generate --clip secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -546,6 +565,7 @@ Describe 'Command-Line Parsing' #|SHOW=clip } When call cmd_generate -c secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -561,6 +581,7 @@ Describe 'Command-Line Parsing' #|SHOW=qrcode } When call cmd_generate --qrcode secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -576,6 +597,7 @@ Describe 'Command-Line Parsing' #|SHOW=qrcode } When call cmd_generate -q secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -591,6 +613,7 @@ Describe 'Command-Line Parsing' #|SHOW=clip } When call cmd_generate --clip --no-symbols secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -606,6 +629,7 @@ Describe 'Command-Line Parsing' #|SHOW=clip } When call cmd_generate -cn secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -621,6 +645,7 @@ Describe 'Command-Line Parsing' #|SHOW=qrcode } When call cmd_generate --no-symbols --qrcode secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -636,6 +661,7 @@ Describe 'Command-Line Parsing' #|SHOW=qrcode } When call cmd_generate -nq secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -651,6 +677,7 @@ Describe 'Command-Line Parsing' #|SHOW=text } When call cmd_generate --inplace secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -666,6 +693,7 @@ Describe 'Command-Line Parsing' #|SHOW=text } When call cmd_generate -i secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -681,6 +709,7 @@ Describe 'Command-Line Parsing' #|SHOW=text } When call cmd_generate --force secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -696,6 +725,7 @@ Describe 'Command-Line Parsing' #|SHOW=text } When call cmd_generate -f secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -778,6 +808,7 @@ Describe 'Command-Line Parsing' #|$ cmd_gitconfig } When call cmd_git init + The status should be success The output should be blank The error should equal "$(result)" End @@ -790,6 +821,7 @@ Describe 'Command-Line Parsing' #|$ cmd_gitconfig } When call cmd_git clone origin + The status should be success The output should be blank The error should equal "$(result)" End @@ -797,13 +829,15 @@ Describe 'Command-Line Parsing' It 'runs the git command into the store' PREFIX="${SHELLSPEC_WORKDIR}/repo" When call cmd_git log --oneline + The status should be success The output should be blank The error should equal "$ git -C ${PREFIX} log --oneline" End - It 'transmits a lack of argument to git' + It 'transmits an empty argument list to git' PREFIX="${SHELLSPEC_WORKDIR}/repo" When run cmd_git + The status should be success The output should be blank The error should equal "$ git -C ${PREFIX}" End @@ -850,6 +884,7 @@ Describe 'Command-Line Parsing' #|$ git -C ${PREFIX} config --local diff.age.textconv age -d -i id } When call cmd_gitconfig + The status should be success The output should be blank The error should equal "$(result)" The contents of file "${PREFIX}/.gitattributes" should equal '*.age diff=age' @@ -871,6 +906,7 @@ Describe 'Command-Line Parsing' #|*.age diff=age } When call cmd_gitconfig + The status should be success The output should be blank The error should equal "$(result)" The contents of file "${PREFIX}/.gitattributes" should equal "$(attrs)" @@ -884,6 +920,7 @@ Describe 'Command-Line Parsing' #|$ git -C ${PREFIX} config --local diff.age.textconv age -d -i id } When call cmd_gitconfig + The status should be success The output should be blank The error should equal "$(result)" The contents of file "${PREFIX}/.gitattributes" should equal '*.age diff=age' @@ -904,6 +941,7 @@ Describe 'Command-Line Parsing' It 'uses the argument list directly' When call cmd_grep -i pattern + The status should be success The output should be blank The error should equal '$ do_grep -i pattern' End @@ -929,6 +967,7 @@ Describe 'Command-Line Parsing' #|$ cmd_usage $ } When call cmd_help + The status should be success The output should be blank The error should equal "$(result)" End @@ -946,6 +985,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=yes } When call cmd_init recipient-1 recipient-2 + The status should be success The output should be blank The error should equal "$(result)" End @@ -959,6 +999,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=yes } When call cmd_init --path=sub recipient + The status should be success The output should be blank The error should equal "$(result)" End @@ -972,6 +1013,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=yes } When call cmd_init --path sub recipient + The status should be success The output should be blank The error should equal "$(result)" End @@ -985,6 +1027,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=yes } When call cmd_init -psub recipient + The status should be success The output should be blank The error should equal "$(result)" End @@ -998,6 +1041,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=yes } When call cmd_init -p sub recipient + The status should be success The output should be blank The error should equal "$(result)" End @@ -1010,6 +1054,7 @@ Describe 'Command-Line Parsing' #|DECISION=default } When call cmd_init -p sub '' + The status should be success The output should be blank The error should equal "$(result)" End @@ -1023,6 +1068,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=yes } When call cmd_init -- -recipient + The status should be success The output should be blank The error should equal "$(result)" End @@ -1082,6 +1128,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=no } When call cmd_insert secret1 secret2 + The status should be success The output should be blank The error should equal "$(result)" End @@ -1096,6 +1143,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=no } When call cmd_insert -- -c + The status should be success The output should be blank The error should equal "$(result)" End @@ -1110,6 +1158,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=no } When call cmd_insert -e secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -1124,6 +1173,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=no } When call cmd_insert --echo secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -1138,6 +1188,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=yes } When call cmd_insert -fe secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -1152,6 +1203,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=yes } When call cmd_insert -e -f secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -1166,6 +1218,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=yes } When call cmd_insert --force --echo secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -1180,6 +1233,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=no } When call cmd_insert -m secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -1194,6 +1248,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=no } When call cmd_insert --multiline secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -1208,6 +1263,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=yes } When call cmd_insert -mf secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -1222,6 +1278,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=yes } When call cmd_insert -m -f secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -1236,6 +1293,7 @@ Describe 'Command-Line Parsing' #|OVERWRITE=yes } When call cmd_insert --force --multiline secret + The status should be success The output should be blank The error should equal "$(result)" End @@ -1290,6 +1348,7 @@ Describe 'Command-Line Parsing' #|SHOW=text } When call cmd_list_or_show + The status should be success The output should be blank The error should equal "$(result)" End @@ -1311,6 +1370,7 @@ Describe 'Command-Line Parsing' #|SHOW=text } When call cmd_list_or_show arg1 arg2 arg3 + The status should be success The output should be blank The error should equal "$(result)" End @@ -1324,6 +1384,7 @@ Describe 'Command-Line Parsing' #|SHOW=text } When call cmd_list_or_show -- -c + The status should be success The output should be blank The error should equal "$(result)" End @@ -1337,6 +1398,7 @@ Describe 'Command-Line Parsing' #|SHOW=clip } When call cmd_list_or_show -c arg + The status should be success The output should be blank The error should equal "$(result)" End @@ -1350,6 +1412,7 @@ Describe 'Command-Line Parsing' #|SHOW=clip } When call cmd_list_or_show --clip arg + The status should be success The output should be blank The error should equal "$(result)" End @@ -1363,6 +1426,7 @@ Describe 'Command-Line Parsing' #|SHOW=clip } When call cmd_list_or_show -c2 arg + The status should be success The output should be blank The error should equal "$(result)" End @@ -1376,6 +1440,7 @@ Describe 'Command-Line Parsing' #|SHOW=clip } When call cmd_list_or_show --clip=2 arg + The status should be success The output should be blank The error should equal "$(result)" End @@ -1389,6 +1454,7 @@ Describe 'Command-Line Parsing' #|SHOW=qrcode } When call cmd_list_or_show -q arg + The status should be success The output should be blank The error should equal "$(result)" End @@ -1402,6 +1468,7 @@ Describe 'Command-Line Parsing' #|SHOW=qrcode } When call cmd_list_or_show --qrcode arg + The status should be success The output should be blank The error should equal "$(result)" End @@ -1415,6 +1482,7 @@ Describe 'Command-Line Parsing' #|SHOW=qrcode } When call cmd_list_or_show -q3 arg + The status should be success The output should be blank The error should equal "$(result)" End @@ -1428,6 +1496,7 @@ Describe 'Command-Line Parsing' #|SHOW=qrcode } When call cmd_list_or_show --qrcode=3 arg + The status should be success The output should be blank The error should equal "$(result)" End @@ -1498,6 +1567,7 @@ Describe 'Command-Line Parsing' #|SCM_ACTION=scm_mv } When call cmd_move src1 src2 src3 dest + The status should be success The output should be blank The error should equal "$(result)" End @@ -1514,6 +1584,7 @@ Describe 'Command-Line Parsing' #|SCM_ACTION=scm_mv } When call cmd_move --force src dest + The status should be success The output should be blank The error should equal "$(result)" End @@ -1530,6 +1601,7 @@ Describe 'Command-Line Parsing' #|SCM_ACTION=scm_mv } When call cmd_move -f src dest + The status should be success The output should be blank The error should equal "$(result)" End @@ -1546,6 +1618,7 @@ Describe 'Command-Line Parsing' #|SCM_ACTION=scm_mv } When call cmd_move -- -s dest + The status should be success The output should be blank The error should equal "$(result)" End @@ -1575,17 +1648,20 @@ Describe 'Command-Line Parsing' It 'generates random characters with default parameters' When run cmd_random + The status should be success The error should equal \ "$ random_chars ${GENERATED_LENGTH} ${CHARACTER_SET}" End It 'generates random characters with default character set' When run cmd_random 8 + The status should be success The error should equal "$ random_chars 8 ${CHARACTER_SET}" End It 'generates random characters with the given arguments' When run cmd_random 8 a-z + The status should be success The error should equal "$ random_chars 8 a-z" End @@ -1606,12 +1682,14 @@ Describe 'Command-Line Parsing' It 'displays a human-reable usage string' When call cmd_usage + The status should be success The first line of output should equal 'Usage:' The error should be blank End It 'includes help about all commands' When call cmd_usage + The status should be success The output should include 'prg copy' The output should include 'prg delete' The output should include 'prg edit' @@ -1659,6 +1737,7 @@ Describe 'Command-Line Parsing' #|============================================== } When call cmd_version + The status should be success The output should match pattern "$(result)" End End