Path: blob/dev/pkg/input/formats/yaml/multidoc_test.go
2070 views
package yaml12import (3"os"4"testing"56"github.com/projectdiscovery/nuclei/v3/pkg/input/types"7"github.com/stretchr/testify/require"8)910func TestYamlFormatterParse(t *testing.T) {11format := New()1213proxifyInputFile := "../testdata/ginandjuice.proxify.yaml"1415expectedUrls := []string{16"https://ginandjuice.shop/blog/post?postId=3&source=proxify",17"https://ginandjuice.shop/users/3",18}1920file, err := os.Open(proxifyInputFile)21require.Nilf(t, err, "error opening proxify input file: %v", err)22defer func() {23_ = file.Close()24}()2526var urls []string27err = format.Parse(file, func(request *types.RequestResponse) bool {28urls = append(urls, request.URL.String())29return false30}, proxifyInputFile)31require.Nilf(t, err, "error parsing yaml file: %v", err)32require.Len(t, urls, len(expectedUrls), "invalid number of urls")33require.ElementsMatch(t, urls, expectedUrls, "invalid urls")34}353637