working on tests

This commit is contained in:
zricethezav committed 2018-03-01 22:35:13 -06:00
1 parent d85c8d8abd
commit 36c31bf181
6 files changed
+97 -99

No files matched your search

+29 -9
View File
@@ -1,6 +1,10 @@
package main
import "testing"
import (
"testing"
"os"
"fmt"
)
func TestNewRepo(t *testing.T) {
// TODO
@@ -11,11 +15,30 @@ func TestNewLocalRepo(t *testing.T) {
}
func TestWriteReport(t *testing.T) {
// TODO
/*
opts, err := defaultOptions()
r := newRepo("fakerepo", "github.com")
sampleLeak := Leak{
opts, _ = defaultOptions()
r := newRepo("fakerepo", "github.com", "")
r.leaks = []Leak{*sampleLeak(), *sampleLeak()}
r.writeReport()
if _, err := os.Stat("fakerepo_leaks.json"); os.IsNotExist(err) {
t.Error()
} else {
os.Remove("fakerepo_leaks.json")
}
}
func TestAudit(t *testing.T) {
opts, _ = defaultOptions()
opts.RepoMode = true
opts.Tmp = true
opts.URL = "https://github.com/zricethezav/gronit"
owner := newOwner()
r := newRepo("gronit", "https://github.com/zricethezav/gronit", owner.path)
r.audit()
}
func sampleLeak() *Leak {
return &Leak{
Line: "yoo",
Commit: "mycommit",
Offender: "oh boy",
@@ -25,7 +48,4 @@ func TestWriteReport(t *testing.T) {
Author: "lol",
RepoURL: "yooo",
}
r.leaks = []Leak{sampleLeak, sampleLeak}
r.writeReport()
*/
}