mirror of
https://github.com/sobolevn/git-secret
synced 2024-11-16 21:26:12 +00:00
test with filenames with spaces
This commit is contained in:
parent
7096499465
commit
c141fd4492
@ -37,6 +37,15 @@ TEST_DEFAULT_USER="user1"
|
||||
TEST_SECOND_USER="user2" # shellcheck disable=2034
|
||||
TEST_ATTACKER_USER="attacker1" # shellcheck disable=2034
|
||||
|
||||
#TEST_DEFAULT_FILENAME="file_one" # no spaces
|
||||
#TEST_SECOND_FILENAME="file_two" # no spaces
|
||||
#TEST_THIRD_FILENAME="file_three" # no spaces
|
||||
|
||||
TEST_DEFAULT_FILENAME="space file" # has spaces
|
||||
TEST_SECOND_FILENAME="space file two" # has spaces
|
||||
TEST_THIRD_FILENAME="space file three" # has spaces
|
||||
|
||||
|
||||
function test_user_password {
|
||||
# It was set on key creation:
|
||||
echo "${1}pass"
|
||||
|
@ -21,7 +21,7 @@ function teardown {
|
||||
|
||||
@test "run 'add' normally" {
|
||||
# Preparations:
|
||||
local filename="local_file"
|
||||
local filename="$TEST_DEFAULT_FILENAME"
|
||||
echo "content" > "$filename"
|
||||
echo "$filename" > ".gitignore"
|
||||
|
||||
@ -41,7 +41,7 @@ function teardown {
|
||||
|
||||
|
||||
@test "run 'add' for unignored file" {
|
||||
local test_file='test_file'
|
||||
local test_file="$TEST_DEFAULT_FILENAME"
|
||||
touch "$test_file"
|
||||
echo "content" > "$test_file"
|
||||
|
||||
@ -53,7 +53,7 @@ function teardown {
|
||||
|
||||
|
||||
@test "run 'add' for unignored file with '-i'" {
|
||||
local test_file='test_file.auto_ignore'
|
||||
local test_file='test_file.auto_ignore' # TODO - paramaterize filename
|
||||
touch "$test_file"
|
||||
echo "content" > "$test_file"
|
||||
|
||||
@ -112,7 +112,7 @@ function teardown {
|
||||
local root='test_dir'
|
||||
local node="$root/node"
|
||||
local sibling="$root/sibling"
|
||||
local test_file="$node/test_file"
|
||||
local test_file="$node/$TEST_DEFAULT_FILENAME"
|
||||
local current_dir=$(pwd)
|
||||
|
||||
mkdir -p "$node"
|
||||
@ -124,7 +124,7 @@ function teardown {
|
||||
cd "$sibling"
|
||||
|
||||
# Testing:
|
||||
run git secret add "../node/test_file"
|
||||
run git secret add "../node/$TEST_DEFAULT_FILENAME"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"1 item(s) added."* ]]
|
||||
|
||||
@ -143,7 +143,7 @@ function teardown {
|
||||
|
||||
@test "run 'add' for file in subfolder" {
|
||||
# Preparations:
|
||||
local test_file='test_file'
|
||||
local test_file="$TEST_DEFAULT_FILENAME"
|
||||
local test_dir='test_dir'
|
||||
|
||||
mkdir -p "$test_dir"
|
||||
@ -163,7 +163,7 @@ function teardown {
|
||||
|
||||
@test "run 'add' twice for one file" {
|
||||
# Preparations:
|
||||
local filename="local_file"
|
||||
local filename="$TEST_DEFAULT_FILENAME"
|
||||
echo "content" > "$filename"
|
||||
echo "$filename" > ".gitignore"
|
||||
|
||||
@ -187,11 +187,11 @@ function teardown {
|
||||
|
||||
@test "run 'add' for multiple files" {
|
||||
# Preparations:
|
||||
local filename1="local_file1"
|
||||
local filename1="$TEST_DEFAULT_FILENAME"
|
||||
echo "content1" > "$filename1"
|
||||
echo "$filename1" > ".gitignore"
|
||||
|
||||
local filename2="local_file2"
|
||||
local filename2="$TEST_SECOND_FILENAME"
|
||||
echo "content2" > "$filename2"
|
||||
echo "$filename2" >> ".gitignore"
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
load _test_base
|
||||
|
||||
FILE_TO_HIDE="file_to_hide"
|
||||
FILE_TO_HIDE="$TEST_DEFAULT_FILENAME"
|
||||
FILE_CONTENTS="hidden content юникод"
|
||||
|
||||
FINGERPRINT=""
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
load _test_base
|
||||
|
||||
FILE_TO_HIDE="file_to_hide"
|
||||
SECOND_FILE_TO_HIDE="second_file_to_hide"
|
||||
FILE_TO_HIDE="$TEST_DEFAULT_FILENAME"
|
||||
SECOND_FILE_TO_HIDE="$TEST_SECOND_FILENAME"
|
||||
FILE_CONTENTS="hidden content юникод"
|
||||
|
||||
FINGERPRINT=""
|
||||
@ -54,7 +54,7 @@ function teardown {
|
||||
|
||||
@test "run 'changes' with hidden file missing" {
|
||||
local password=$(test_user_password "$TEST_DEFAULT_USER")
|
||||
local encrypted_file=$(_get_encrypted_filename $FILE_TO_HIDE)
|
||||
local encrypted_file=$(_get_encrypted_filename "$FILE_TO_HIDE")
|
||||
rm "$encrypted_file"
|
||||
|
||||
run git secret changes -d "$TEST_GPG_HOMEDIR" -p "$password" "$FILE_TO_HIDE"
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
load _test_base
|
||||
|
||||
FIRST_FILE="file_to_hide1"
|
||||
SECOND_FILE="file_to_hide2"
|
||||
FIRST_FILE="$TEST_DEFAULT_FILENAME"
|
||||
SECOND_FILE="$TEST_SECOND_FILENAME"
|
||||
|
||||
FOLDER="somedir"
|
||||
FILE_IN_FOLDER="${FOLDER}/file_to_hide3"
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
load _test_base
|
||||
|
||||
FILE_TO_HIDE="file_to_hide"
|
||||
FILE_TO_HIDE="$TEST_DEFAULT_FILENAME"
|
||||
FILE_CONTENTS="hidden content юникод"
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ function teardown {
|
||||
|
||||
@test "run 'hide' with missing file" {
|
||||
# Preparations:
|
||||
local second_file="second_file.txt"
|
||||
local second_file="$TEST_SECOND_FILENAME"
|
||||
local second_content="some content"
|
||||
set_state_secret_add "$second_file" "$second_content"
|
||||
|
||||
@ -77,7 +77,7 @@ function teardown {
|
||||
|
||||
@test "run 'hide' with multiple files" {
|
||||
# Preparations:
|
||||
local second_file="second_file.txt"
|
||||
local second_file="$TEST_SECOND_FILENAME"
|
||||
local second_content="some content"
|
||||
set_state_secret_add "$second_file" "$second_content"
|
||||
|
||||
@ -183,7 +183,7 @@ function teardown {
|
||||
# Preparations:
|
||||
local root_dir='test_sub_dir'
|
||||
mkdir -p "$root_dir"
|
||||
local second_file="$root_dir/second_file.txt"
|
||||
local second_file="$root_dir/$TEST_SECOND_FILENAME"
|
||||
local second_content="some content"
|
||||
set_state_secret_add "$second_file" "$second_content"
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
load _test_base
|
||||
|
||||
FILE_TO_HIDE="file_to_hide"
|
||||
FILE_TO_HIDE="$TEST_DEFAULT_FILENAME"
|
||||
FILE_CONTENTS="hidden content юникод"
|
||||
|
||||
FINGERPRINT=""
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
load _test_base
|
||||
|
||||
FILE_TO_HIDE="file_to_hide"
|
||||
FILE_TO_HIDE="$TEST_DEFAULT_FILENAME"
|
||||
FILE_CONTENTS="hidden content юникод"
|
||||
|
||||
FINGERPRINT=""
|
||||
|
Loading…
Reference in New Issue
Block a user