mirror of
https://github.com/sobolevn/git-secret
synced 2024-11-02 21:40:18 +00:00
57 lines
998 B
Bash
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." ]
|
|
}
|