mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-21 06:43:05 -08:00
37 lines
653 B
Go
37 lines
653 B
Go
package option
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func Test_splitCustomHeaders(t *testing.T) {
|
|
type args struct {
|
|
headers []string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want http.Header
|
|
}{
|
|
{
|
|
name: "happy path",
|
|
args: args{
|
|
headers: []string{"x-api-token:foo bar", "Authorization:user:password"},
|
|
},
|
|
want: http.Header{
|
|
"X-Api-Token": []string{"foo bar"},
|
|
"Authorization": []string{"user:password"},
|
|
},
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got := splitCustomHeaders(tt.args.headers)
|
|
assert.Equal(t, tt.want, got)
|
|
})
|
|
}
|
|
}
|