mirror of
https://github.com/ffuf/ffuf
synced 2025-02-17 20:38:24 +00:00
44 lines
786 B
Go
44 lines
786 B
Go
package output
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/ffuf/ffuf/pkg/ffuf"
|
|
)
|
|
|
|
func TestToCSV(t *testing.T) {
|
|
result := ffuf.Result{
|
|
Input: map[string][]byte{"x": {66}},
|
|
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"}) {
|
|
|
|
t.Errorf("CSV was not generated in expected format")
|
|
}
|
|
}
|