add test for -C option. fix typos in comments.

pull/245/head
joshr 6 years ago
parent 835fe80d8f
commit afec23fb17

@ -32,11 +32,37 @@ function teardown {
[ "$status" -eq 0 ]
[ "$output" = "done. all 1 files are hidden." ]
# New files should be crated:
# New files should be created:
local encrypted_file=$(_get_encrypted_filename "$FILE_TO_HIDE")
[ -f "$encrypted_file" ]
}
@test "run 'hide' with '-C'" {
# attempt to alter permissions on input file
chmod o-rwx "$FILE_TO_HIDE"
run git secret hide -C
# Command must execute normally:
[ "$status" -eq 0 ]
[ "$output" = "done. all 1 files are hidden." ]
# New files should be created:
local encrypted_file=$(_get_encrypted_filename "$FILE_TO_HIDE")
[ -f "$encrypted_file" ]
# permissions should match. We don't have access to SECRETS_OCTAL_PERMS_COMMAND here
local secret_perm
local file_perm
secret_perm=$(ls -l "$encrypted_file" | cut -d' ' -f1)
file_perm=$(ls -l "$FILE_TO_HIDE" | cut -d' ' -f1)
echo "# secret_perm: $secret_perm, file_perm: $file_perm" >&3
[ "$secret_perm" = "$file_perm" ]
}
@test "run 'hide' from inside subdirectory" {
# Preparations:
local root_dir='test_sub_dir'
@ -101,7 +127,7 @@ function teardown {
[ "${lines[0]}" = "done. all 1 files are hidden." ]
[ "${lines[1]}" = "cleaning up..." ]
# New files should be crated:
# New files should be created:
local encrypted_file=$(_get_encrypted_filename "$FILE_TO_HIDE")
[ -f "$encrypted_file" ]
}
@ -130,7 +156,7 @@ function teardown {
# no changes should occur to path_mappings files
cmp -s "${path_mappings}" "${path_mappings}.bak"
# New files should be crated:
# New files should be created:
local encrypted_file=$(_get_encrypted_filename "$FILE_TO_HIDE")
[ -f "$encrypted_file" ]
}

Loading…
Cancel
Save