mirror of
https://github.com/sobolevn/git-secret
synced 2024-11-06 15:20:36 +00:00
8b1a01f1f6
The full list of changes: 1. Added `.docker/` folder with Dockerfiles 2. Now `travis` runs integrational tests inside these containers 3. Now `travis` runs tests with `mac os x` 4. Now there are new ways to autodeploy `deb` and `rpm` packages 5. Fixed some issues 6. Also added `.ci/` folder, where utility scripts for travis are stored 7. Moved `git-hooks` into the separate folder: `utils/hooks/` 8. Added new target to the `Makefile` 9. `.gitignore` is updated to ignore `build/` folder and inner files
84 lines
2.0 KiB
Bash
84 lines
2.0 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load _test_base
|
|
|
|
FIRST_FILE="file_to_hide1"
|
|
SECOND_FILE="file_to_hide2"
|
|
|
|
# There was a bug with `sed` an slashes:
|
|
# see https://github.com/sobolevn/git-secret/issues/23
|
|
FOLDER="somedir"
|
|
FILE_IN_FOLDER="${FOLDER}/file_to_hide3"
|
|
|
|
|
|
function setup {
|
|
install_fixture_full_key "$TEST_DEFAULT_USER"
|
|
|
|
set_state_git
|
|
set_state_secret_init
|
|
set_state_secret_tell "$TEST_DEFAULT_USER"
|
|
set_state_secret_add "$FIRST_FILE" "somecontent"
|
|
set_state_secret_add "$SECOND_FILE" "somecontent2"
|
|
}
|
|
|
|
|
|
function teardown {
|
|
uninstall_fixture_full_key "$TEST_DEFAULT_USER"
|
|
unset_current_state
|
|
rm -f "$FIRST_FILE" "$SECOND_FILE"
|
|
|
|
# This needs to be cleaned
|
|
rm -rf "$FOLDER"
|
|
}
|
|
|
|
|
|
@test "run 'remove' normally" {
|
|
git secret hide
|
|
|
|
run git secret remove "$SECOND_FILE"
|
|
[ "$status" -eq 0 ]
|
|
|
|
local mapping_contains=$(grep "$SECOND_FILE" "$SECRETS_DIR_PATHS_MAPPING"; echo $?)
|
|
[ "$mapping_contains" -eq 1 ]
|
|
|
|
local first_enctypted_file=$(_get_encrypted_filename $FIRST_FILE)
|
|
local second_enctypted_file=$(_get_encrypted_filename $SECOND_FILE)
|
|
|
|
[ -f "$first_enctypted_file" ]
|
|
[ -f "$second_enctypted_file" ]
|
|
}
|
|
|
|
|
|
@test "run 'remove' with slashes in filename" {
|
|
mkdir -p "$FOLDER"
|
|
set_state_secret_add "$FILE_IN_FOLDER" "somecontent3"
|
|
git secret hide
|
|
|
|
run git secret remove "$FILE_IN_FOLDER"
|
|
[ "$status" -eq 0 ]
|
|
|
|
local mapping_contains=$(grep "$FILE_IN_FOLDER" "$SECRETS_DIR_PATHS_MAPPING"; echo $?)
|
|
[ "$mapping_contains" -eq 1 ]
|
|
|
|
local enctypted_file=$(_get_encrypted_filename $FILE_IN_FOLDER)
|
|
[ -f "$enctypted_file" ]
|
|
}
|
|
|
|
|
|
@test "run 'remove -c'" {
|
|
git secret hide
|
|
|
|
run git secret remove -c "$SECOND_FILE"
|
|
echo "$output"
|
|
[ "$status" -eq 0 ]
|
|
|
|
local mapping_contains=$(grep "$SECOND_FILE" "$SECRETS_DIR_PATHS_MAPPING"; echo $?)
|
|
[ "$mapping_contains" -eq 1 ]
|
|
|
|
local first_enctypted_file=$(_get_encrypted_filename $FIRST_FILE)
|
|
local second_enctypted_file=$(_get_encrypted_filename $SECOND_FILE)
|
|
|
|
[ -f "$first_enctypted_file" ]
|
|
[ ! -f "$second_enctypted_file" ]
|
|
}
|