File: requests_test.go

package info (click to toggle)
golang-github-smallstep-crypto 0.57.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,284 kB
  • sloc: sh: 53; makefile: 36
file content (51 lines) | stat: -rw-r--r-- 1,530 bytes parent folder | download | duplicates (5)
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
package apiv1

import "testing"

func TestProtectionLevel_String(t *testing.T) {
	tests := []struct {
		name string
		p    ProtectionLevel
		want string
	}{
		{"unspecified", UnspecifiedProtectionLevel, "unspecified"},
		{"software", Software, "software"},
		{"hsm", HSM, "hsm"},
		{"unknown", ProtectionLevel(100), "unknown(100)"},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := tt.p.String(); got != tt.want {
				t.Errorf("ProtectionLevel.String() = %v, want %v", got, tt.want)
			}
		})
	}
}

func TestSignatureAlgorithm_String(t *testing.T) {
	tests := []struct {
		name string
		s    SignatureAlgorithm
		want string
	}{
		{"UnspecifiedSignAlgorithm", UnspecifiedSignAlgorithm, "unspecified"},
		{"SHA256WithRSA", SHA256WithRSA, "SHA256-RSA"},
		{"SHA384WithRSA", SHA384WithRSA, "SHA384-RSA"},
		{"SHA512WithRSA", SHA512WithRSA, "SHA512-RSA"},
		{"SHA256WithRSAPSS", SHA256WithRSAPSS, "SHA256-RSAPSS"},
		{"SHA384WithRSAPSS", SHA384WithRSAPSS, "SHA384-RSAPSS"},
		{"SHA512WithRSAPSS", SHA512WithRSAPSS, "SHA512-RSAPSS"},
		{"ECDSAWithSHA256", ECDSAWithSHA256, "ECDSA-SHA256"},
		{"ECDSAWithSHA384", ECDSAWithSHA384, "ECDSA-SHA384"},
		{"ECDSAWithSHA512", ECDSAWithSHA512, "ECDSA-SHA512"},
		{"PureEd25519", PureEd25519, "Ed25519"},
		{"unknown", SignatureAlgorithm(100), "unknown(100)"},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := tt.s.String(); got != tt.want {
				t.Errorf("SignatureAlgorithm.String() = %v, want %v", got, tt.want)
			}
		})
	}
}