Add Stringer interface to provisioner.Type.
Add missing file.
This commit is contained in:
parent
6e4a09651a
commit
37f2096dff
2 changed files with 44 additions and 0 deletions
|
@ -89,6 +89,24 @@ const (
|
|||
SignAudienceKey = "sign"
|
||||
)
|
||||
|
||||
// String returns the string representation of the type.
|
||||
func (t Type) String() string {
|
||||
switch t {
|
||||
case TypeJWK:
|
||||
return "JWK"
|
||||
case TypeOIDC:
|
||||
return "OIDC"
|
||||
case TypeGCP:
|
||||
return "GCP"
|
||||
case TypeAWS:
|
||||
return "AWS"
|
||||
case TypeAzure:
|
||||
return "Azure"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// Config defines the default parameters used in the initialization of
|
||||
// provisioners.
|
||||
type Config struct {
|
||||
|
|
26
authority/provisioner/provisioner_test.go
Normal file
26
authority/provisioner/provisioner_test.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package provisioner
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestType_String(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
t Type
|
||||
want string
|
||||
}{
|
||||
{"JWK", TypeJWK, "JWK"},
|
||||
{"OIDC", TypeOIDC, "OIDC"},
|
||||
{"AWS", TypeAWS, "AWS"},
|
||||
{"Azure", TypeAzure, "Azure"},
|
||||
{"GCP", TypeGCP, "GCP"},
|
||||
{"noop", noopType, ""},
|
||||
{"notFound", 1000, ""},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := tt.t.String(); got != tt.want {
|
||||
t.Errorf("Type.String() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue