@@ -75,26 +75,26 @@ func TestOSXKeychainHelperRetrieveAliases(t *testing.T) {
75
75
76
76
helper := Osxkeychain {}
77
77
defer func () {
78
- for _ , te := range tests {
79
- helper .Delete (te .storeURL )
78
+ for _ , tc := range tests {
79
+ helper .Delete (tc .storeURL )
80
80
}
81
81
}()
82
82
83
83
// Clean store before testing.
84
- for _ , te := range tests {
85
- helper .Delete (te .storeURL )
84
+ for _ , tc := range tests {
85
+ helper .Delete (tc .storeURL )
86
86
}
87
87
88
- for _ , te := range tests {
89
- c := & credentials.Credentials {ServerURL : te .storeURL , Username : "hello" , Secret : "world" }
88
+ for _ , tc := range tests {
89
+ c := & credentials.Credentials {ServerURL : tc .storeURL , Username : "hello" , Secret : "world" }
90
90
if err := helper .Add (c ); err != nil {
91
- t .Errorf ("Error: failed to store secret for URL %q: %s" , te .storeURL , err )
91
+ t .Errorf ("Error: failed to store secret for URL %q: %s" , tc .storeURL , err )
92
92
continue
93
93
}
94
- if _ , _ , err := helper .Get (te .readURL ); err != nil {
95
- t .Errorf ("Error: failed to read secret for URL %q using %q" , te .storeURL , te .readURL )
94
+ if _ , _ , err := helper .Get (tc .readURL ); err != nil {
95
+ t .Errorf ("Error: failed to read secret for URL %q using %q" , tc .storeURL , tc .readURL )
96
96
}
97
- helper .Delete (te .storeURL )
97
+ helper .Delete (tc .storeURL )
98
98
}
99
99
}
100
100
@@ -118,34 +118,34 @@ func TestOSXKeychainHelperRetrieveStrict(t *testing.T) {
118
118
{"https://foobar.docker.io:1234" , "https://foobar.docker.io:5678" },
119
119
120
120
// non-matching ports TODO is this desired behavior? The other way round does work
121
- //{"https://foobar.docker.io", "https://foobar.docker.io:5678"},
121
+ // {"https://foobar.docker.io", "https://foobar.docker.io:5678"},
122
122
123
123
// non-matching paths
124
124
{"https://foobar.docker.io:1234/one/two" , "https://foobar.docker.io:1234/five/six" },
125
125
}
126
126
127
127
helper := Osxkeychain {}
128
128
defer func () {
129
- for _ , te := range tests {
130
- helper .Delete (te .storeURL )
129
+ for _ , tc := range tests {
130
+ helper .Delete (tc .storeURL )
131
131
}
132
132
}()
133
133
134
134
// Clean store before testing.
135
- for _ , te := range tests {
136
- helper .Delete (te .storeURL )
135
+ for _ , tc := range tests {
136
+ helper .Delete (tc .storeURL )
137
137
}
138
138
139
- for _ , te := range tests {
140
- c := & credentials.Credentials {ServerURL : te .storeURL , Username : "hello" , Secret : "world" }
139
+ for _ , tc := range tests {
140
+ c := & credentials.Credentials {ServerURL : tc .storeURL , Username : "hello" , Secret : "world" }
141
141
if err := helper .Add (c ); err != nil {
142
- t .Errorf ("Error: failed to store secret for URL %q: %s" , te .storeURL , err )
142
+ t .Errorf ("Error: failed to store secret for URL %q: %s" , tc .storeURL , err )
143
143
continue
144
144
}
145
- if _ , _ , err := helper .Get (te .readURL ); err == nil {
146
- t .Errorf ("Error: managed to read secret for URL %q using %q, but should not be able to" , te .storeURL , te .readURL )
145
+ if _ , _ , err := helper .Get (tc .readURL ); err == nil {
146
+ t .Errorf ("Error: managed to read secret for URL %q using %q, but should not be able to" , tc .storeURL , tc .readURL )
147
147
}
148
- helper .Delete (te .storeURL )
148
+ helper .Delete (tc .storeURL )
149
149
}
150
150
}
151
151
@@ -167,39 +167,39 @@ func TestOSXKeychainHelperStoreRetrieve(t *testing.T) {
167
167
168
168
helper := Osxkeychain {}
169
169
defer func () {
170
- for _ , te := range tests {
171
- helper .Delete (te .url )
170
+ for _ , tc := range tests {
171
+ helper .Delete (tc .url )
172
172
}
173
173
}()
174
174
175
175
// Clean store before testing.
176
- for _ , te := range tests {
177
- helper .Delete (te .url )
176
+ for _ , tc := range tests {
177
+ helper .Delete (tc .url )
178
178
}
179
179
180
180
// Note that we don't delete between individual tests here, to verify that
181
181
// subsequent stores/overwrites don't affect storing / retrieving secrets.
182
- for i , te := range tests {
182
+ for i , tc := range tests {
183
183
c := & credentials.Credentials {
184
- ServerURL : te .url ,
184
+ ServerURL : tc .url ,
185
185
Username : fmt .Sprintf ("user-%d" , i ),
186
186
Secret : fmt .Sprintf ("secret-%d" , i ),
187
187
}
188
188
189
189
if err := helper .Add (c ); err != nil {
190
- t .Errorf ("Error: failed to store secret for URL: %s: %s" , te .url , err )
190
+ t .Errorf ("Error: failed to store secret for URL: %s: %s" , tc .url , err )
191
191
continue
192
192
}
193
- user , secret , err := helper .Get (te .url )
193
+ user , secret , err := helper .Get (tc .url )
194
194
if err != nil {
195
- t .Errorf ("Error: failed to read secret for URL %q: %s" , te .url , err )
195
+ t .Errorf ("Error: failed to read secret for URL %q: %s" , tc .url , err )
196
196
continue
197
197
}
198
198
if user != c .Username {
199
- t .Errorf ("Error: expected username %s, got username %s for URL: %s" , c .Username , user , te .url )
199
+ t .Errorf ("Error: expected username %s, got username %s for URL: %s" , c .Username , user , tc .url )
200
200
}
201
201
if secret != c .Secret {
202
- t .Errorf ("Error: expected secret %s, got secret %s for URL: %s" , c .Secret , secret , te .url )
202
+ t .Errorf ("Error: expected secret %s, got secret %s for URL: %s" , c .Secret , secret , tc .url )
203
203
}
204
204
}
205
205
}
0 commit comments