-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Expand file tree
/
Copy pathprotocols_test.go
More file actions
35 lines (28 loc) · 1.08 KB
/
Copy pathprotocols_test.go
File metadata and controls
35 lines (28 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package protocols
import (
"testing"
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/interactsh"
"github.com/projectdiscovery/nuclei/v3/pkg/types"
"github.com/stretchr/testify/require"
)
func TestExecutorOptionsCopyPreservesInteractshScope(t *testing.T) {
client, err := interactsh.New(interactsh.DefaultOptions(nil, nil, nil))
require.NoError(t, err)
scope := client.NewRequestScope()
copy := (&ExecutorOptions{Interactsh: client, InteractshScope: scope}).Copy()
require.Same(t, client, copy.Interactsh)
require.Same(t, scope, copy.InteractshScope)
}
func TestExecutorOptionsApplyNewEngineOptionsReplacesInteractshScope(t *testing.T) {
client, err := interactsh.New(interactsh.DefaultOptions(nil, nil, nil))
require.NoError(t, err)
previous := client.NewRequestScope()
next := client.NewRequestScope()
reused := &ExecutorOptions{Interactsh: client, InteractshScope: previous}
reused.ApplyNewEngineOptions(&ExecutorOptions{
Options: &types.Options{},
Interactsh: client,
InteractshScope: next,
})
require.Same(t, next, reused.InteractshScope)
}