Debian Codegraph @

pkg/filter/status_test.go

raw symbols SCIP
1 package filterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/
2
3 import (
4 "stringsscip-go gomod github.com/golang/go/src go1.18 strings/"
5 "testingscip-go gomod github.com/golang/go/src go1.18 testing/"
6
7 "github.com/ffuf/ffuf/v2/pkg/ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/"
8 )
9
10 func TestNewStatusFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/TestNewStatusFilter().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
11 f, _ := NewStatusFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/NewStatusFilter().("200,301,400-410,500")
12 statusRepr := f.Reprscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/FilterProvider#Repr.()
13 if !stringsscip-go gomod github.com/golang/go/src go1.18 strings/.Containsscip-go gomod github.com/golang/go/src go1.18 strings/Contains().(statusRepr, "200,301,400-410,500") {
14 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Status filter was expected to have 4 values")
15 }
16 }
17
18 func TestNewStatusFilterErrorscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/TestNewStatusFilterError().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
19 _, err := NewStatusFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/NewStatusFilter().("invalid")
20 if err == nil {
21 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Was expecting an error from errenous input data")
22 }
23 }
24
25 func TestStatusFilteringscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/TestStatusFiltering().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
26 f, _ := NewStatusFilterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/filter`/NewStatusFilter().("200,301,400-498,500")
27 for i, test := range []struct {
28 input int64
29 output bool
30 }{
31 {200, true},
32 {301, true},
33 {500, true},
34 {4, false},
35 {399, false},
36 {400, true},
37 {444, true},
38 {498, true},
39 {499, false},
40 {302, false},
41 } {
42 resp := ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Responsescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#{StatusCodescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#StatusCode.: test.input}
43 filterReturn, _ := f.Filterscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/FilterProvider#Filter.(&resp)
44 if filterReturn != test.output {
45 t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("Filter test %d: Was expecing filter return value of %t but got %t", i, test.output, filterReturn)
46 }
47 }
48 }