Skip to content

Commit

Permalink
fix tests in subdirectories
Browse files Browse the repository at this point in the history
  • Loading branch information
yukinying committed Oct 9, 2015
1 parent 019f168 commit 5898e61
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 26 deletions.
39 changes: 20 additions & 19 deletions cmd/gryffin-distributed/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,28 @@

package main

import (
"net/http"
"net/http/httptest"
"os"
"testing"
// Unit test for gryffin-distributed is still on todo list.
//
// import (
// "net/http"
// "net/http/httptest"
// "os"
// "testing"

"github.com/yahoo/gryffin"
"github.com/yahoo/gryffin/data"
)
// "github.com/yahoo/gryffin"
// )

var h = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello World"))
})
// var handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// w.Write([]byte("Hello World"))
// })

var ts = httptest.NewServer(h)
// var ts = httptest.NewServer(handler)

func TestMain(t *testing.T) {
if os.Getenv("INTEGRATION") == "" {
t.Skip("Skip integration tests.")
}
scan := gryffin.NewScan("GET", ts.URL, "", data.NewMemoryStore(), os.Stdout)
linkChannels(scan)
// func TestMain(t *testing.T) {
// if os.Getenv("INTEGRATION") == "" {
// t.Skip("Skip integration tests.")
// }
// scan := gryffin.NewScan("GET", ts.URL, "")
// linkChannels(scan)

}
// }
3 changes: 1 addition & 2 deletions cmd/gryffin-standalone/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"testing"

"github.com/yahoo/gryffin"
"github.com/yahoo/gryffin/data"
)

var h = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Expand All @@ -24,7 +23,7 @@ func TestMain(t *testing.T) {
if os.Getenv("INTEGRATION") == "" {
t.Skip("Skip integration tests.")
}
scan := gryffin.NewScan("GET", ts.URL, "", data.NewMemoryStore(), os.Stdout)
scan := gryffin.NewScan("GET", ts.URL, "")
linkChannels(scan)

}
2 changes: 1 addition & 1 deletion fuzzer/arachni/arachni_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestFuzzer(t *testing.T) {
t.Skip("Skip integration tests.")
}
s := &Fuzzer{}
scan := gryffin.NewScan("GET", "http://127.0.0.1:8081/xss/reflect/full1?in=change_me", "", nil, os.Stdout)
scan := gryffin.NewScan("GET", "http://127.0.0.1:8081/xss/reflect/full1?in=change_me", "")
c, err := s.Fuzz(scan)
if err != nil {
t.Error(err)
Expand Down
2 changes: 1 addition & 1 deletion fuzzer/dummy/dummy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func TestFuzzer(t *testing.T) {

f := &Fuzzer{}
scan := gryffin.NewScan("GET", "http://www.yahoo.com", "", nil, os.Stdout)
scan := gryffin.NewScan("GET", "http://www.yahoo.com", "")
_, err := f.Fuzz(scan)
if err != nil {
t.Error(err)
Expand Down
2 changes: 1 addition & 1 deletion fuzzer/sqlmap/sqlmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestFuzzer(t *testing.T) {
}

s := &Fuzzer{}
scan := gryffin.NewScan("GET", "http://127.0.0.1:8082/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit", "", nil, os.Stdout)
scan := gryffin.NewScan("GET", "http://127.0.0.1:8082/dvwa/vulnerabilities/sqli/?id=1&Submit=Submit", "")
c, err := s.Fuzz(scan)
if err != nil {
t.Error(err)
Expand Down
3 changes: 1 addition & 2 deletions renderer/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"testing"

"github.com/yahoo/gryffin"
"github.com/yahoo/gryffin/data"
)

func testCrawlAsync(t *testing.T, r gryffin.Renderer) {
Expand All @@ -19,7 +18,7 @@ func testCrawlAsync(t *testing.T, r gryffin.Renderer) {

url := "https://www.yahoo.com/"

s := gryffin.NewScan("GET", url, "", data.NewMemoryStore(), os.Stdout)
s := gryffin.NewScan("GET", url, "")
r.Do(s)
s = <-r.GetRequestBody()
// t.Logf("Got async body %s", s)
Expand Down

0 comments on commit 5898e61

Please sign in to comment.