@@ -42,7 +42,7 @@ func (m *memoryStore) List() (map[string]string, error) {
4242}
4343
4444func TestStore (t * testing.T ) {
45- serverURL : = "https://index.docker.io/v1/"
45+ const serverURL = "https://index.docker.io/v1/"
4646 creds := & Credentials {
4747 ServerURL : serverURL ,
4848 Username : "foo" ,
@@ -65,11 +65,11 @@ func TestStore(t *testing.T) {
6565 }
6666
6767 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 )
6969 }
7070
7171 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 )
7373 }
7474}
7575
@@ -89,7 +89,7 @@ func TestStoreMissingServerURL(t *testing.T) {
8989 h := newMemoryStore ()
9090
9191 if err := Store (h , in ); IsCredentialsMissingServerURL (err ) == false {
92- t .Fatal (err )
92+ t .Error (err )
9393 }
9494}
9595
@@ -109,12 +109,12 @@ func TestStoreMissingUsername(t *testing.T) {
109109 h := newMemoryStore ()
110110
111111 if err := Store (h , in ); IsCredentialsMissingUsername (err ) == false {
112- t .Fatal (err )
112+ t .Error (err )
113113 }
114114}
115115
116116func TestGet (t * testing.T ) {
117- serverURL : = "https://index.docker.io/v1/"
117+ const serverURL = "https://index.docker.io/v1/"
118118 creds := & Credentials {
119119 ServerURL : serverURL ,
120120 Username : "foo" ,
@@ -147,16 +147,16 @@ func TestGet(t *testing.T) {
147147 }
148148
149149 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 )
151151 }
152152
153153 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 )
155155 }
156156}
157157
158158func TestGetMissingServerURL (t * testing.T ) {
159- serverURL : = "https://index.docker.io/v1/"
159+ const serverURL = "https://index.docker.io/v1/"
160160 creds := & Credentials {
161161 ServerURL : serverURL ,
162162 Username : "foo" ,
@@ -177,12 +177,12 @@ func TestGetMissingServerURL(t *testing.T) {
177177 w := new (bytes.Buffer )
178178
179179 if err := Get (h , buf , w ); IsCredentialsMissingServerURL (err ) == false {
180- t .Fatal (err )
180+ t .Error (err )
181181 }
182182}
183183
184184func TestErase (t * testing.T ) {
185- serverURL : = "https://index.docker.io/v1/"
185+ const serverURL = "https://index.docker.io/v1/"
186186 creds := & Credentials {
187187 ServerURL : serverURL ,
188188 Username : "foo" ,
@@ -206,12 +206,12 @@ func TestErase(t *testing.T) {
206206
207207 w := new (bytes.Buffer )
208208 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" )
210210 }
211211}
212212
213213func TestEraseMissingServerURL (t * testing.T ) {
214- serverURL : = "https://index.docker.io/v1/"
214+ const serverURL = "https://index.docker.io/v1/"
215215 creds := & Credentials {
216216 ServerURL : serverURL ,
217217 Username : "foo" ,
@@ -244,6 +244,6 @@ func TestList(t *testing.T) {
244244 }
245245 // testing that there is an output
246246 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" )
248248 }
249249}
0 commit comments