mirror of https://github.com/sobolevn/git-secret
list and whoknows commands added
parent
d6cb27b5dd
commit
2b48137287
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
function list {
|
||||
_user_required
|
||||
|
||||
if [[ ! -s "$SECRETS_DIR_PATHS_MAPPING" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while read line; do
|
||||
echo "$line"
|
||||
done < "$SECRETS_DIR_PATHS_MAPPING"
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
function whoknows {
|
||||
_user_required
|
||||
|
||||
local keys=$(_get_users_in_keyring)
|
||||
echo "$keys"
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
#!/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 'list' normally" {
|
||||
run git secret list
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "$FILE_TO_HIDE" ]
|
||||
}
|
||||
|
||||
|
||||
@test "run 'list' on empty repo" {
|
||||
git secret remove "$FILE_TO_HIDE"
|
||||
|
||||
run git secret list
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load _test_base
|
||||
|
||||
|
||||
function setup {
|
||||
install_fixture_key "$TEST_DEFAULT_USER"
|
||||
install_fixture_key "user2"
|
||||
|
||||
set_state_git
|
||||
set_state_secret_init
|
||||
set_state_secret_tell "$TEST_DEFAULT_USER"
|
||||
set_state_secret_tell "user2"
|
||||
}
|
||||
|
||||
|
||||
function teardown {
|
||||
uninstall_fixture_key $TEST_DEFAULT_USER
|
||||
unset_current_state
|
||||
|
||||
rm -f "$FILE_TO_HIDE"
|
||||
}
|
||||
|
||||
|
||||
@test "run 'whoknows' normally" {
|
||||
run git secret whoknows
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
Loading…
Reference in New Issue