trufflehog/pkg/detectors/endpoint_customizer_test.go
Miccah b1675194ca
Implement EndpointCustomizer (#1291)
* Implement EndpointCustomizer

Add the EndpointCustomizer interface and EndpointSetter convenience struct,
implement EndpointCustomizer for github and gitlab detectors, and add
parsing, verification, and applying user-supplied configuration.

* Check error from SetEndpoints

* Rename variable for clarity
2023-04-27 12:23:50 -05:00

16 lines
384 B
Go

package detectors
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestEmbeddedEndpointSetter(t *testing.T) {
type Scanner struct{ EndpointSetter }
var s Scanner
assert.Equal(t, []string{"baz"}, s.Endpoints("baz"))
assert.NoError(t, s.SetEndpoints("foo", "bar"))
assert.Error(t, s.SetEndpoints())
assert.Equal(t, []string{"foo", "bar"}, s.Endpoints("baz"))
}