@@ -42,7 +42,7 @@ func (m *memoryStore) List() (map[string]string, error) {
42
42
}
43
43
44
44
func TestStore (t * testing.T ) {
45
- serverURL : = "https://index.docker.io/v1/"
45
+ const serverURL = "https://index.docker.io/v1/"
46
46
creds := & Credentials {
47
47
ServerURL : serverURL ,
48
48
Username : "foo" ,
@@ -65,11 +65,11 @@ func TestStore(t *testing.T) {
65
65
}
66
66
67
67
if c .Username != "foo" {
68
- t .Fatalf ("expected username foo, got %s\n " , c .Username )
68
+ t .Errorf ("expected username foo, got %s\n " , c .Username )
69
69
}
70
70
71
71
if c .Secret != "bar" {
72
- t .Fatalf ("expected username bar, got %s\n " , c .Secret )
72
+ t .Errorf ("expected username bar, got %s\n " , c .Secret )
73
73
}
74
74
}
75
75
@@ -89,7 +89,7 @@ func TestStoreMissingServerURL(t *testing.T) {
89
89
h := newMemoryStore ()
90
90
91
91
if err := Store (h , in ); IsCredentialsMissingServerURL (err ) == false {
92
- t .Fatal (err )
92
+ t .Error (err )
93
93
}
94
94
}
95
95
@@ -109,12 +109,12 @@ func TestStoreMissingUsername(t *testing.T) {
109
109
h := newMemoryStore ()
110
110
111
111
if err := Store (h , in ); IsCredentialsMissingUsername (err ) == false {
112
- t .Fatal (err )
112
+ t .Error (err )
113
113
}
114
114
}
115
115
116
116
func TestGet (t * testing.T ) {
117
- serverURL : = "https://index.docker.io/v1/"
117
+ const serverURL = "https://index.docker.io/v1/"
118
118
creds := & Credentials {
119
119
ServerURL : serverURL ,
120
120
Username : "foo" ,
@@ -147,16 +147,16 @@ func TestGet(t *testing.T) {
147
147
}
148
148
149
149
if c .Username != "foo" {
150
- t .Fatalf ("expected username foo, got %s\n " , c .Username )
150
+ t .Errorf ("expected username foo, got %s\n " , c .Username )
151
151
}
152
152
153
153
if c .Secret != "bar" {
154
- t .Fatalf ("expected username bar, got %s\n " , c .Secret )
154
+ t .Errorf ("expected username bar, got %s\n " , c .Secret )
155
155
}
156
156
}
157
157
158
158
func TestGetMissingServerURL (t * testing.T ) {
159
- serverURL : = "https://index.docker.io/v1/"
159
+ const serverURL = "https://index.docker.io/v1/"
160
160
creds := & Credentials {
161
161
ServerURL : serverURL ,
162
162
Username : "foo" ,
@@ -177,12 +177,12 @@ func TestGetMissingServerURL(t *testing.T) {
177
177
w := new (bytes.Buffer )
178
178
179
179
if err := Get (h , buf , w ); IsCredentialsMissingServerURL (err ) == false {
180
- t .Fatal (err )
180
+ t .Error (err )
181
181
}
182
182
}
183
183
184
184
func TestErase (t * testing.T ) {
185
- serverURL : = "https://index.docker.io/v1/"
185
+ const serverURL = "https://index.docker.io/v1/"
186
186
creds := & Credentials {
187
187
ServerURL : serverURL ,
188
188
Username : "foo" ,
@@ -206,12 +206,12 @@ func TestErase(t *testing.T) {
206
206
207
207
w := new (bytes.Buffer )
208
208
if err := Get (h , buf , w ); err == nil {
209
- t .Fatal ("expected error getting missing creds, got empty" )
209
+ t .Error ("expected error getting missing creds, got empty" )
210
210
}
211
211
}
212
212
213
213
func TestEraseMissingServerURL (t * testing.T ) {
214
- serverURL : = "https://index.docker.io/v1/"
214
+ const serverURL = "https://index.docker.io/v1/"
215
215
creds := & Credentials {
216
216
ServerURL : serverURL ,
217
217
Username : "foo" ,
@@ -244,6 +244,6 @@ func TestList(t *testing.T) {
244
244
}
245
245
// testing that there is an output
246
246
if out .Len () == 0 {
247
- t .Fatalf ("expected output in the writer, got %d" , 0 )
247
+ t .Error ("expected output in the writer, got 0" )
248
248
}
249
249
}
0 commit comments