-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathconstants_test.go
79 lines (72 loc) · 1.53 KB
/
constants_test.go
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package jwkset
import (
"testing"
)
const (
invalid = "invalid"
)
func TestALG(t *testing.T) {
a := AlgHS256
if a.String() != string(a) {
t.Errorf("Failed to get proper string from String method.")
}
if !a.IANARegistered() {
t.Errorf("Failed to validate valid ALG.")
}
a = invalid
if a.IANARegistered() {
t.Errorf("Do not validate invalid ALG.")
}
}
func TestCRV(t *testing.T) {
c := CrvP256
if c.String() != string(c) {
t.Errorf("Failed to get proper string from String method.")
}
if !c.IANARegistered() {
t.Errorf("Failed to validate valid CRV.")
}
c = invalid
if c.IANARegistered() {
t.Errorf("Do not validate invalid CRV.")
}
}
func TestKEYOPS(t *testing.T) {
k := KeyOpsSign
if k.String() != string(k) {
t.Errorf("Failed to get proper string from String method.")
}
if !k.IANARegistered() {
t.Errorf("Failed to validate valid KEYOPS.")
}
k = invalid
if k.IANARegistered() {
t.Errorf("Do not validate invalid KEYOPS.")
}
}
func TestKTY(t *testing.T) {
k := KtyEC
if k.String() != string(k) {
t.Errorf("Failed to get proper string from String method.")
}
if !k.IANARegistered() {
t.Errorf("Failed to validate valid KTY.")
}
k = invalid
if k.IANARegistered() {
t.Errorf("Do not validate invalid KTY.")
}
}
func TestUSE(t *testing.T) {
u := UseEnc
if u.String() != string(u) {
t.Errorf("Failed to get proper string from String method.")
}
if !u.IANARegistered() {
t.Errorf("Failed to validate valid USE.")
}
u = invalid
if u.IANARegistered() {
t.Errorf("Do not validate invalid USE.")
}
}