Skip to content

Commit

Permalink
added comment line test
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwittig committed May 10, 2016
1 parent 45e3d87 commit 1896080
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/git-secrets.bats
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,18 @@ load test_helper
[ $status -eq 1 ]
}

@test "Comment lines must be ignored in .gitallowed files" {
setup_bad_repo_with_hash
repo_run git-secrets --scan
[ $status -eq 1 ]
echo '#hash' > $TEST_REPO/.gitallowed
repo_run git-secrets --scan
[ $status -eq 1 ]
echo 'hash' > $TEST_REPO/.gitallowed
repo_run git-secrets --scan
[ $status -eq 0 ]
}

@test "Scans all files and allowing none of the bad patterns in .gitallowed" {
setup_bad_repo
echo 'hello' > $TEST_REPO/.gitallowed
Expand Down
9 changes: 9 additions & 0 deletions test/test_helper.bash
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ setup_repo() {
git init
git config --local --add secrets.patterns '@todo'
git config --local --add secrets.patterns 'forbidden|me'
git config --local --add secrets.patterns '#hash'
git config --local user.email "you@example.com"
git config --local user.name "Your Name"
cd -
Expand Down Expand Up @@ -65,6 +66,14 @@ setup_bad_repo_with_spaces() {
cd -
}

# Creates a repo that should fail
setup_bad_repo_with_hash() {
cd $TEST_REPO
echo '#hash' > "$TEST_REPO/data.txt"
git add -A
cd -
}

# Creates a repo that should fail
setup_bad_repo_history() {
cd $TEST_REPO
Expand Down

0 comments on commit 1896080

Please sign in to comment.