mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 05:24:22 +01:00
linting, more testing, cleaning
This commit is contained in:
1 parent
36c31bf181
commit
0ed0489c2d
6 files changed
+113
-72
No files matched your search
+31
-16
@@ -1,17 +1,20 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
_ "fmt"
|
||||
"os"
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewRepo(t *testing.T) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
func TestNewLocalRepo(t *testing.T) {
|
||||
// TODO
|
||||
r := newLocalRepo("")
|
||||
if r.path != "" {
|
||||
t.Error()
|
||||
}
|
||||
r = newLocalRepo("some/path")
|
||||
if r.name != "path" || r.path != "some/path" {
|
||||
t.Error()
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriteReport(t *testing.T) {
|
||||
@@ -32,20 +35,32 @@ func TestAudit(t *testing.T) {
|
||||
opts.Tmp = true
|
||||
opts.URL = "https://github.com/zricethezav/gronit"
|
||||
owner := newOwner()
|
||||
r := newRepo("gronit", "https://github.com/zricethezav/gronit", owner.path)
|
||||
r.audit()
|
||||
r := newRepo("gronit", opts.URL, owner.path)
|
||||
leaksPst, _ := r.audit()
|
||||
if !leaksPst {
|
||||
// TODO setup actual test repo
|
||||
t.Error()
|
||||
}
|
||||
|
||||
// new owner
|
||||
opts.URL = "https://github.com/kelseyhightower/nocode"
|
||||
owner = newOwner()
|
||||
r = newRepo("nocode", opts.URL, owner.path)
|
||||
leaksPst, _ = r.audit()
|
||||
if leaksPst {
|
||||
t.Error()
|
||||
}
|
||||
}
|
||||
|
||||
func sampleLeak() *Leak {
|
||||
return &Leak{
|
||||
Line: "yoo",
|
||||
Commit: "mycommit",
|
||||
Line: "yoo",
|
||||
Commit: "mycommit",
|
||||
Offender: "oh boy",
|
||||
Reason: "hello",
|
||||
Msg: "msg",
|
||||
Time: "time",
|
||||
Author: "lol",
|
||||
RepoURL: "yooo",
|
||||
Reason: "hello",
|
||||
Msg: "msg",
|
||||
Time: "time",
|
||||
Author: "lol",
|
||||
RepoURL: "yooo",
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user