From df952094a12c73aa0e55b37bd81b05c838d43fef Mon Sep 17 00:00:00 2001 From: Tim Byrne Date: Mon, 4 Sep 2017 12:59:13 -0500 Subject: [PATCH] Add test case for supporting directories in .yadm/encrypt (#81) --- test/109_accept_encryption.bats | 45 +++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/test/109_accept_encryption.bats b/test/109_accept_encryption.bats index 33280e1..8f0eb69 100644 --- a/test/109_accept_encryption.bats +++ b/test/109_accept_encryption.bats @@ -96,8 +96,15 @@ EOF while IFS='' read -r glob || [ -n "$glob" ]; do if [[ ! $glob =~ ^# && ! $glob =~ ^[[:space:]]*$ ]] ; then local IFS=$'\n' - for matching_file in $(eval ls "$glob" 2>/dev/null); do - echo "$matching_file" + for matching_file in $(eval ls -d "$glob" 2>/dev/null); do + if [ -d "$matching_file" ]; then + echo "$matching_file/" + for subfile in "$matching_file"/*; do + echo "$subfile" + done + else + echo "$matching_file" + fi done fi done < "$T_YADM_ENCRYPT" | sort > "$T_TMP/expected_list" @@ -311,6 +318,40 @@ EOF validate_archive symmetric } +@test "Command 'encrypt' (directories in YADM_ENCRYPT)" { + echo " + When 'encrypt' command is provided, + and YADM_ENCRYPT is present + Create YADM_ARCHIVE + Report the archive created + Archive should be valid + Exit with 0 + " + + #; add directory paths to YADM_ARCHIVE + local original_encrypt + original_encrypt=$(cat "$T_YADM_ENCRYPT") + echo -e "'space test'" >> "$T_YADM_ENCRYPT" + + #; run encrypt + run expect <