forked from hashicorp/cap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalgs_test.go
More file actions
45 lines (41 loc) · 808 Bytes
/
algs_test.go
File metadata and controls
45 lines (41 loc) · 808 Bytes
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
36
37
38
39
40
41
42
43
44
45
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package jwt
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestSupportedSigningAlgorithm(t *testing.T) {
type args struct {
algs []Alg
}
tests := []struct {
name string
args args
wantErr bool
}{
{
name: "supported signing algorithms",
args: args{
algs: []Alg{RS256, RS384, RS512, ES256, ES384, ES512, PS256, PS384, PS512, EdDSA},
},
},
{
name: "unsupported signing algorithm none",
args: args{
algs: []Alg{Alg("none")},
},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := SupportedSigningAlgorithm(tt.args.algs...)
if tt.wantErr {
require.Error(t, err)
return
}
require.NoError(t, err)
})
}
}