mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 09:45:27 +00:00
* Basic headless fuzzing * Remove debug statements * Add integration tests * Update template * Fix recognize payload value in matcher * Update tempalte * use req.SetURL() --------- Co-authored-by: Tarun Koyalwar <tarun@projectdiscovery.io>
23 lines
589 B
Go
23 lines
589 B
Go
package fuzz
|
|
|
|
import (
|
|
"testing"
|
|
|
|
urlutil "github.com/projectdiscovery/utils/url"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestRuleIsExecutable(t *testing.T) {
|
|
rule := &Rule{Part: "query"}
|
|
err := rule.Compile(nil, nil)
|
|
require.NoError(t, err, "could not compile rule")
|
|
|
|
parsed, _ := urlutil.Parse("https://example.com/?url=localhost")
|
|
result := rule.isExecutable(parsed)
|
|
require.True(t, result, "could not get correct result")
|
|
|
|
parsed, _ = urlutil.Parse("https://example.com/")
|
|
result = rule.isExecutable(parsed)
|
|
require.False(t, result, "could not get correct result")
|
|
}
|