File: options_test.go

package info (click to toggle)
golang-github-smallstep-certificates 0.20.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,144 kB
  • sloc: sh: 278; makefile: 170
file content (45 lines) | stat: -rw-r--r-- 819 bytes parent folder | download
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
package policy

import (
	"testing"
)

func TestX509PolicyOptions_IsWildcardLiteralAllowed(t *testing.T) {
	tests := []struct {
		name    string
		options *X509PolicyOptions
		want    bool
	}{
		{
			name:    "nil-options",
			options: nil,
			want:    true,
		},
		{
			name:    "not-set",
			options: &X509PolicyOptions{},
			want:    false,
		},
		{
			name: "set-true",
			options: &X509PolicyOptions{
				AllowWildcardNames: true,
			},
			want: true,
		},
		{
			name: "set-false",
			options: &X509PolicyOptions{
				AllowWildcardNames: false,
			},
			want: false,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := tt.options.AreWildcardNamesAllowed(); got != tt.want {
				t.Errorf("X509PolicyOptions.IsWildcardLiteralAllowed() = %v, want %v", got, tt.want)
			}
		})
	}
}