1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
package output
import (
"reflect"
"testing"
"time"
"github.com/ffuf/ffuf/v2/pkg/ffuf"
)
func TestToCSV(t *testing.T) {
result := ffuf.Result{
Input: map[string][]byte{"x": {66}, "FFUFHASH": {65}},
Position: 1,
StatusCode: 200,
ContentLength: 3,
ContentWords: 4,
ContentLines: 5,
ContentType: "application/json",
RedirectLocation: "http://no.pe",
Url: "http://as.df",
Duration: time.Duration(123),
ResultFile: "resultfile",
Host: "host",
}
csv := toCSV(result)
if !reflect.DeepEqual(csv, []string{
"B",
"http://as.df",
"http://no.pe",
"1",
"200",
"3",
"4",
"5",
"application/json",
"123ns",
"resultfile",
"A"}) {
t.Errorf("CSV was not generated in expected format")
}
}
|