Path: blob/dev/pkg/input/formats/burp/burp_test.go
2070 views
package burp12import (3"os"4"testing"56"github.com/projectdiscovery/nuclei/v3/pkg/input/types"7"github.com/stretchr/testify/require"8)910func TestBurpParse(t *testing.T) {11format := New()1213proxifyInputFile := "../testdata/burp.xml"1415var gotMethodsToURLs []string1617file, err := os.Open(proxifyInputFile)18require.Nilf(t, err, "error opening proxify input file: %v", err)19defer func() {20_ = file.Close()21}()2223err = format.Parse(file, func(request *types.RequestResponse) bool {24gotMethodsToURLs = append(gotMethodsToURLs, request.URL.String())25return false26}, proxifyInputFile)27if err != nil {28t.Fatal(err)29}3031if len(gotMethodsToURLs) != 2 {32t.Fatalf("invalid number of methods: %d", len(gotMethodsToURLs))33}34var expectedURLs = []string{35"http://localhost:8087/scans",36"http://google.com/",37}38require.ElementsMatch(t, expectedURLs, gotMethodsToURLs, "could not get burp urls")39}404142