nuclei/v2/pkg/templates/compile_test.go
2021-02-04 01:09:29 +05:30

26 lines
844 B
Go

package templates
import (
"testing"
"github.com/projectdiscovery/nuclei/v2/pkg/types"
"github.com/stretchr/testify/require"
)
func TestMatchTemplateWithTags(t *testing.T) {
templateTags := []interface{}{"php", "linux", "symfony"}
err := matchTemplateWithTags(templateTags, &types.Options{Tags: []string{"php"}})
require.Nil(t, err, "could not get php tag from input slice")
templateTags = []interface{}{"lang:php", "os:linux", "cms:symfony"}
err = matchTemplateWithTags(templateTags, &types.Options{Tags: []string{"cms:symfony"}})
require.Nil(t, err, "could not get php tag from input key value")
templateTags = []interface{}{"lang:php", "os:linux", "symfony"}
err = matchTemplateWithTags(templateTags, &types.Options{Tags: []string{"cms:symfony"}})
require.NotNil(t, err, "could get key value tag from input key value")
}