mirror of
https://github.com/sobolevn/git-secret
synced 2024-11-02 21:40:18 +00:00
22fe1ed2d4
* Support SECRETS_VERBOSE env var in addition to -v * don't use --quiet when decrypting in verbose mode * show output of gpg encryption in verbose mode * add tests for SECRETS_VERBOSE env var set to 0 and 1 * update changelog, reorder entries. * add tests for 'cat' and 'hide' with SECRETS_VERBOSE=1
54 lines
1.3 KiB
Bash
54 lines
1.3 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load _test_base
|
|
|
|
FILE_TO_HIDE="$TEST_DEFAULT_FILENAME"
|
|
FILE_CONTENTS="hidden content юникод"
|
|
|
|
FINGERPRINT=""
|
|
|
|
|
|
function setup {
|
|
FINGERPRINT=$(install_fixture_full_key "$TEST_DEFAULT_USER")
|
|
|
|
set_state_initial
|
|
set_state_git
|
|
set_state_secret_init
|
|
set_state_secret_tell "$TEST_DEFAULT_USER"
|
|
set_state_secret_add "$FILE_TO_HIDE" "$FILE_CONTENTS"
|
|
set_state_secret_hide
|
|
}
|
|
|
|
|
|
function teardown {
|
|
uninstall_fixture_full_key "$TEST_DEFAULT_USER" "$FINGERPRINT"
|
|
unset_current_state
|
|
}
|
|
|
|
|
|
@test "run 'cat' with password argument" {
|
|
local password=$(test_user_password "$TEST_DEFAULT_USER")
|
|
run git secret cat -d "$TEST_GPG_HOMEDIR" -p "$password" "$FILE_TO_HIDE"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
# $output is the output from 'git secret cat' above
|
|
[ "$FILE_CONTENTS" == "$output" ]
|
|
}
|
|
|
|
@test "run 'cat' with password argument and SECRETS_VERBOSE=1" {
|
|
local password=$(test_user_password "$TEST_DEFAULT_USER")
|
|
SECRETS_VERBOSE=1 run git secret cat -d "$TEST_GPG_HOMEDIR" -p "$password" "$FILE_TO_HIDE"
|
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
# $output _contains_ the output from 'git secret cat', may have extra output from gpg
|
|
[[ "$output" == *"$FILE_CONTENTS"* ]]
|
|
}
|
|
|
|
@test "run 'cat' with wrong filename" {
|
|
run git secret cat -d "$TEST_GPG_HOMEDIR" -p "$password" NO_SUCH_FILE
|
|
[ "$status" -eq 2 ]
|
|
}
|
|
|