@@ -156,7 +156,7 @@ func TestOneShotFileServer(t *testing.T) {
156
156
client , _ , l := oneShotProxy (t )
157
157
defer l .Close ()
158
158
159
- file := "panda.png"
159
+ file := "test_data/ panda.png"
160
160
info , err := os .Stat (file )
161
161
if err != nil {
162
162
t .Fatal ("Cannot find" , file )
@@ -183,7 +183,7 @@ func TestContentType(t *testing.T) {
183
183
return resp
184
184
})
185
185
186
- for _ , file := range []string {"panda.png" , "football.png" } {
186
+ for _ , file := range []string {"test_data/ panda.png" , "test_data/ football.png" } {
187
187
if resp , err := client .Get (localFile (file )); err != nil || resp .Header .Get ("X-Shmoopi" ) != "1" {
188
188
if err == nil {
189
189
t .Error ("pngs should have X-Shmoopi header = 1, actually" , resp .Header .Get ("X-Shmoopi" ))
@@ -265,13 +265,13 @@ func TestConstantImageHandler(t *testing.T) {
265
265
defer l .Close ()
266
266
267
267
//panda := getImage("panda.png", t)
268
- football := getImage ("football.png" , t )
268
+ football := getImage ("test_data/ football.png" , t )
269
269
270
270
proxy .OnResponse ().HandleImage (func (img image.Image , ctx * ProxyCtx ) image.Image {
271
271
return football
272
272
})
273
273
274
- resp , err := client .Get (localFile ("panda.png" ))
274
+ resp , err := client .Get (localFile ("test_data/ panda.png" ))
275
275
if err != nil {
276
276
t .Fatal ("Cannot get panda.png" ,err )
277
277
}
@@ -289,13 +289,13 @@ func TestImageHandler(t *testing.T) {
289
289
var _ = client
290
290
defer l .Close ()
291
291
292
- football := getImage ("football.png" , t )
292
+ football := getImage ("test_data/ football.png" , t )
293
293
294
- proxy .OnResponse (UrlIs ("/panda.png" )).HandleImage (func (img image.Image , ctx * ProxyCtx ) image.Image {
294
+ proxy .OnResponse (UrlIs ("/test_data/ panda.png" )).HandleImage (func (img image.Image , ctx * ProxyCtx ) image.Image {
295
295
return football
296
296
})
297
297
298
- resp , err := client .Get (localFile ("panda.png" ))
298
+ resp , err := client .Get (localFile ("test_data/ panda.png" ))
299
299
if err != nil {
300
300
t .Fatal ("Cannot get panda.png" ,err )
301
301
}
@@ -308,7 +308,7 @@ func TestImageHandler(t *testing.T) {
308
308
}
309
309
310
310
// and again
311
- resp , err = client .Get (localFile ("panda.png" ))
311
+ resp , err = client .Get (localFile ("test_data/ panda.png" ))
312
312
if err != nil {
313
313
t .Fatal ("Cannot get panda.png" ,err )
314
314
}
@@ -332,7 +332,7 @@ func TestChangeResp(t *testing.T) {
332
332
return resp
333
333
})
334
334
335
- resp ,err := client .Get (localFile ("panda.png" ))
335
+ resp ,err := client .Get (localFile ("test_data/ panda.png" ))
336
336
if err != nil {
337
337
t .Fatal (err )
338
338
}
@@ -346,21 +346,21 @@ func TestReplaceImage(t *testing.T) {
346
346
client , proxy , l := oneShotProxy (t )
347
347
defer l .Close ()
348
348
349
- panda := getImage ("panda.png" , t )
350
- football := getImage ("football.png" , t )
349
+ panda := getImage ("test_data/ panda.png" , t )
350
+ football := getImage ("test_data/ football.png" , t )
351
351
352
- proxy .OnResponse (UrlIs ("/panda.png" )).HandleImage (func (img image.Image , ctx * ProxyCtx ) image.Image {
352
+ proxy .OnResponse (UrlIs ("/test_data/ panda.png" )).HandleImage (func (img image.Image , ctx * ProxyCtx ) image.Image {
353
353
return football
354
354
})
355
- proxy .OnResponse (UrlIs ("/football.png" )).HandleImage (func (img image.Image , ctx * ProxyCtx ) image.Image {
355
+ proxy .OnResponse (UrlIs ("/test_data/ football.png" )).HandleImage (func (img image.Image , ctx * ProxyCtx ) image.Image {
356
356
return panda
357
357
})
358
358
359
- imgByPandaReq ,_ ,err := image .Decode (bytes .NewReader (getOrFail (localFile ("panda.png" ),client ,t )))
359
+ imgByPandaReq ,_ ,err := image .Decode (bytes .NewReader (getOrFail (localFile ("test_data/ panda.png" ),client ,t )))
360
360
fatalOnErr (err ,"decode panda" ,t )
361
361
compareImage (football ,imgByPandaReq ,t )
362
362
363
- imgByFootballReq ,_ ,err := image .Decode (bytes .NewReader (getOrFail (localFile ("football.png" ),client ,t )))
363
+ imgByFootballReq ,_ ,err := image .Decode (bytes .NewReader (getOrFail (localFile ("test_data/ football.png" ),client ,t )))
364
364
fatalOnErr (err ,"decode football" ,t )
365
365
compareImage (panda ,imgByFootballReq ,t )
366
366
}
0 commit comments