Peter Kurfer
7c2a41ad25
- apply changes in proxy plugin and TLS interceptor - add HTTPS proxy support - move ca-generation command to main app - minor refactoring to improve API stability - move mocks to extra packages to avoid cycling imports - fix bug in multi-port configuration - change HTTP proxy to redirect to HTTP mock instead of maintaining custom rules
39 lines
818 B
Go
39 lines
818 B
Go
package cert
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func Test_certOptionsDefaulter(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
arg GenerationOptions
|
|
expected GenerationOptions
|
|
}{
|
|
{
|
|
name: "",
|
|
arg: GenerationOptions{
|
|
CommonName: "CA",
|
|
},
|
|
expected: GenerationOptions{
|
|
CommonName: "CA",
|
|
Country: []string{"US"},
|
|
Locality: []string{"San Francisco"},
|
|
Organization: []string{"INetMock"},
|
|
StreetAddress: []string{"Golden Gate Bridge"},
|
|
PostalCode: []string{"94016"},
|
|
Province: []string{""},
|
|
},
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
certOptionsDefaulter(&tt.arg)
|
|
if !reflect.DeepEqual(tt.expected, tt.arg) {
|
|
t.Errorf("Apply defaulter expected=%v got=%v", tt.expected, tt.arg)
|
|
}
|
|
})
|
|
}
|
|
}
|