|
|
|
@ -39,16 +39,19 @@ function teardown {
|
|
|
|
|
[ -f "$encrypted_file" ]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@test "run 'hide' with extra filename" {
|
|
|
|
|
run git secret hide extra_filename
|
|
|
|
|
[ "$status" -ne 0 ]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@test "run 'hide' with bad arg" {
|
|
|
|
|
run git secret hide -Z
|
|
|
|
|
[ "$status" -ne 0 ]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@test "run 'hide' normally with SECRETS_VERBOSE=1" {
|
|
|
|
|
SECRETS_VERBOSE=1 run git secret hide
|
|
|
|
|
|
|
|
|
@ -57,6 +60,7 @@ function teardown {
|
|
|
|
|
[[ "$output" == *"git-secret: done. 1 of 1 files are hidden."* ]]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@test "run 'hide' with '-P'" {
|
|
|
|
|
# attempt to alter permissions on input file
|
|
|
|
|
chmod o-rwx "$FILE_TO_HIDE"
|
|
|
|
@ -82,8 +86,8 @@ function teardown {
|
|
|
|
|
[ "$secret_perm" = "$file_perm" ]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@test "run 'hide' from inside subdirectory" {
|
|
|
|
|
|
|
|
|
|
@test "run 'hide' from inside subdirectory" {
|
|
|
|
|
if [[ "$BATS_RUNNING_FROM_GIT" -eq 1 ]]; then
|
|
|
|
|
# See #334 for more about this
|
|
|
|
|
skip "this test is skipped while 'git commit'"
|
|
|
|
@ -111,6 +115,7 @@ function teardown {
|
|
|
|
|
rm -rf "$root_dir"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@test "run 'hide' with missing file" {
|
|
|
|
|
# Preparations:
|
|
|
|
|
local second_file="$TEST_SECOND_FILENAME"
|
|
|
|
@ -149,7 +154,8 @@ function teardown {
|
|
|
|
|
|
|
|
|
|
# Command must execute normally:
|
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
# git secret hide -m: uses temp file so cleaning should take place, but we only show tmp file cleanup in VERBOSE mode
|
|
|
|
|
# git secret hide -m: uses temp file so cleaning should take place,
|
|
|
|
|
# but we only show tmp file cleanup in VERBOSE mode
|
|
|
|
|
[ "${lines[0]}" = "git-secret: done. 1 of 1 files are hidden." ]
|
|
|
|
|
|
|
|
|
|
# New files should be created:
|
|
|
|
@ -167,7 +173,8 @@ function teardown {
|
|
|
|
|
|
|
|
|
|
# Command must execute normally:
|
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
# git secret hide -m: uses temp file so cleaning should take place, but we only show tmp file cleanup in VERBOSE mode
|
|
|
|
|
# git secret hide -m: uses temp file so cleaning should take place,
|
|
|
|
|
# but we only show tmp file cleanup in VERBOSE mode
|
|
|
|
|
[[ "${lines[0]}" == *"git-secret: done. 1 of 1 files are hidden."* ]]
|
|
|
|
|
|
|
|
|
|
# back path mappings
|
|
|
|
@ -178,7 +185,8 @@ function teardown {
|
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
[[ "${#lines[@]}" -eq 1 ]]
|
|
|
|
|
|
|
|
|
|
# output says 0 of 1 files are hidden because checksum didn't change and we didn't need to hide it again.
|
|
|
|
|
# output says 0 of 1 files are hidden because checksum didn't change
|
|
|
|
|
# and we didn't need to hide it again.
|
|
|
|
|
[[ "$output" == *"git-secret: done. 0 of 1 files are hidden."* ]]
|
|
|
|
|
# no changes should occur to path_mappings files
|
|
|
|
|
cmp -s "${path_mappings}" "${path_mappings}.bak"
|
|
|
|
@ -198,7 +206,8 @@ function teardown {
|
|
|
|
|
|
|
|
|
|
# Command must execute normally:
|
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
# git secret hide -m: uses temp file so cleaning should take place, but we only show tmp file cleanup in VERBOSE mode
|
|
|
|
|
# git secret hide -m: uses temp file so cleaning should take place,
|
|
|
|
|
# but we only show tmp file cleanup in VERBOSE mode
|
|
|
|
|
[[ "${lines[0]}" == *"git-secret: done. 1 of 1 files are hidden."* ]]
|
|
|
|
|
|
|
|
|
|
# back path mappings
|
|
|
|
@ -209,7 +218,8 @@ function teardown {
|
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
|
[[ "${#lines[@]}" -eq 1 ]]
|
|
|
|
|
|
|
|
|
|
# output says 0 of 1 files are hidden because checksum didn't change and we didn't need to hide it again.
|
|
|
|
|
# output says 0 of 1 files are hidden because checksum didn't change
|
|
|
|
|
# and we didn't need to hide it again.
|
|
|
|
|
[[ "$output" == *"git-secret: done. 0 of 1 files are hidden."* ]]
|
|
|
|
|
# no changes should occur to path_mappings files
|
|
|
|
|
cmp -s "${path_mappings}" "${path_mappings}.bak"
|
|
|
|
|