@@ -10,30 +10,30 @@ import (
10
10
"github.com/notaryproject/notation-go/verifier/trustpolicy"
11
11
)
12
12
13
- func TestNotaryOptions (t * testing.T ) {
13
+ func TestOptionsForNotary (t * testing.T ) {
14
14
testCases := []struct {
15
15
name string
16
16
opts []NotationOptions
17
- want * notationOptions
17
+ want * options
18
18
}{
19
19
{
20
20
name : "no options" ,
21
- want : & notationOptions {},
21
+ want : & options {},
22
22
},
23
23
{
24
24
name : "signature option" ,
25
25
opts : []NotationOptions {WithNotaryPublicCertificate ([]byte ("foo" ))},
26
- want : & notationOptions {
27
- PublicCertificate : []byte ("foo" ),
28
- ROpt : nil ,
26
+ want : & options {
27
+ PublicKey : []byte ("foo" ),
28
+ ROpt : nil ,
29
29
},
30
30
},
31
31
{
32
32
name : "keychain option" ,
33
33
opts : []NotationOptions {WithNotaryRemoteOptions (remote .WithAuthFromKeychain (authn .DefaultKeychain ))},
34
- want : & notationOptions {
35
- PublicCertificate : nil ,
36
- ROpt : []remote.Option {remote .WithAuthFromKeychain (authn .DefaultKeychain )},
34
+ want : & options {
35
+ PublicKey : nil ,
36
+ ROpt : []remote.Option {remote .WithAuthFromKeychain (authn .DefaultKeychain )},
37
37
},
38
38
},
39
39
{
@@ -42,8 +42,8 @@ func TestNotaryOptions(t *testing.T) {
42
42
remote .WithAuth (& authn.Basic {Username : "foo" , Password : "bar" }),
43
43
remote .WithAuthFromKeychain (authn .DefaultKeychain ),
44
44
)},
45
- want : & notationOptions {
46
- PublicCertificate : nil ,
45
+ want : & options {
46
+ PublicKey : nil ,
47
47
ROpt : []remote.Option {
48
48
remote .WithAuth (& authn.Basic {Username : "foo" , Password : "bar" }),
49
49
remote .WithAuthFromKeychain (authn .DefaultKeychain ),
@@ -57,8 +57,8 @@ func TestNotaryOptions(t *testing.T) {
57
57
remote .WithAuthFromKeychain (authn .DefaultKeychain ),
58
58
remote .WithTransport (http .DefaultTransport ),
59
59
)},
60
- want : & notationOptions {
61
- PublicCertificate : nil ,
60
+ want : & options {
61
+ PublicKey : nil ,
62
62
ROpt : []remote.Option {
63
63
remote .WithAuth (& authn.Basic {Username : "foo" , Password : "bar" }),
64
64
remote .WithAuthFromKeychain (authn .DefaultKeychain ),
@@ -69,62 +69,62 @@ func TestNotaryOptions(t *testing.T) {
69
69
{
70
70
name : "truststore, empty document" ,
71
71
opts : []NotationOptions {WithTrustStore (& trustpolicy.Document {})},
72
- want : & notationOptions {
73
- PublicCertificate : nil ,
74
- ROpt : nil ,
75
- TrustStore : & trustpolicy.Document {},
72
+ want : & options {
73
+ PublicKey : nil ,
74
+ ROpt : nil ,
75
+ TrustStore : & trustpolicy.Document {},
76
76
},
77
77
},
78
78
{
79
79
name : "truststore, dummy document" ,
80
80
opts : []NotationOptions {WithTrustStore (dummyPolicyDocument ())},
81
- want : & notationOptions {
82
- PublicCertificate : nil ,
83
- ROpt : nil ,
84
- TrustStore : dummyPolicyDocument (),
81
+ want : & options {
82
+ PublicKey : nil ,
83
+ ROpt : nil ,
84
+ TrustStore : dummyPolicyDocument (),
85
85
},
86
86
},
87
87
{
88
88
name : "insecure, false" ,
89
89
opts : []NotationOptions {WithInsecureRegistry (false )},
90
- want : & notationOptions {
91
- PublicCertificate : nil ,
92
- ROpt : nil ,
93
- TrustStore : nil ,
94
- Insecure : false ,
90
+ want : & options {
91
+ PublicKey : nil ,
92
+ ROpt : nil ,
93
+ TrustStore : nil ,
94
+ Insecure : false ,
95
95
},
96
96
},
97
97
{
98
98
name : "insecure, true" ,
99
99
opts : []NotationOptions {WithInsecureRegistry (true )},
100
- want : & notationOptions {
101
- PublicCertificate : nil ,
102
- ROpt : nil ,
103
- TrustStore : nil ,
104
- Insecure : true ,
100
+ want : & options {
101
+ PublicKey : nil ,
102
+ ROpt : nil ,
103
+ TrustStore : nil ,
104
+ Insecure : true ,
105
105
},
106
106
},
107
107
{
108
108
name : "insecure, default" ,
109
109
opts : []NotationOptions {},
110
- want : & notationOptions {
111
- PublicCertificate : nil ,
112
- ROpt : nil ,
113
- TrustStore : nil ,
114
- Insecure : false ,
110
+ want : & options {
111
+ PublicKey : nil ,
112
+ ROpt : nil ,
113
+ TrustStore : nil ,
114
+ Insecure : false ,
115
115
},
116
116
},
117
117
}
118
118
119
119
// Run the test cases
120
120
for _ , tc := range testCases {
121
121
t .Run (tc .name , func (t * testing.T ) {
122
- o := notationOptions {}
122
+ o := options {}
123
123
for _ , opt := range tc .opts {
124
124
opt (& o )
125
125
}
126
- if ! reflect .DeepEqual (o .PublicCertificate , tc .want .PublicCertificate ) {
127
- t .Errorf ("got %#v, want %#v" , & o .PublicCertificate , tc .want .PublicCertificate )
126
+ if ! reflect .DeepEqual (o .PublicKey , tc .want .PublicKey ) {
127
+ t .Errorf ("got %#v, want %#v" , & o .PublicKey , tc .want .PublicKey )
128
128
}
129
129
130
130
if ! reflect .DeepEqual (o .TrustStore , tc .want .TrustStore ) {
0 commit comments