git-secret/tests/test_hide.bats

57 lines
998 B
Bash

#!/usr/bin/env bats
load _test_base
FILE_TO_HIDE="file_to_hide"
FILE_CONTENTS="hidden content юникод"
function setup {
install_fixture_key "$TEST_DEFAULT_USER"
set_state_git
set_state_secret_init
set_state_secret_tell "$TEST_DEFAULT_USER"
set_state_secret_add "$FILE_TO_HIDE" "$FILE_CONTENTS"
}
function teardown {
uninstall_fixture_key $TEST_DEFAULT_USER
unset_current_state
rm -f "$FILE_TO_HIDE"
}
@test "run 'hide' normally" {
run git secret hide
[ "$status" -eq 0 ]
[ "$output" = "done. all 1 files are hidden." ]
}
@test "run 'hide' with -c param" {
run git secret hide -v -c
[ "$status" -eq 0 ]
}
@test "run 'hide' with -d param" {
run git secret hide -v -d
[ "$status" -eq 0 ]
[ ! -f "$FILE_TO_HIDE" ]
}
@test "run 'hide' for multiple users" {
local new_user="user2"
install_fixture_key "$new_user"
set_state_secret_tell "$new_user"
run git secret hide
[ "$status" -eq 0 ]
[ "$output" = "done. all 1 files are hidden." ]
}