Skip to content

Commit d40a391

Browse files
committed
move test data to its own dir
1 parent 3544b15 commit d40a391

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

proxy_test.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func TestOneShotFileServer(t *testing.T) {
156156
client, _, l := oneShotProxy(t)
157157
defer l.Close()
158158

159-
file := "panda.png"
159+
file := "test_data/panda.png"
160160
info, err := os.Stat(file)
161161
if err != nil {
162162
t.Fatal("Cannot find", file)
@@ -183,7 +183,7 @@ func TestContentType(t *testing.T) {
183183
return resp
184184
})
185185

186-
for _, file := range []string{"panda.png", "football.png"} {
186+
for _, file := range []string{"test_data/panda.png", "test_data/football.png"} {
187187
if resp, err := client.Get(localFile(file)); err != nil || resp.Header.Get("X-Shmoopi") != "1" {
188188
if err == nil {
189189
t.Error("pngs should have X-Shmoopi header = 1, actually", resp.Header.Get("X-Shmoopi"))
@@ -265,13 +265,13 @@ func TestConstantImageHandler(t *testing.T) {
265265
defer l.Close()
266266

267267
//panda := getImage("panda.png", t)
268-
football := getImage("football.png", t)
268+
football := getImage("test_data/football.png", t)
269269

270270
proxy.OnResponse().HandleImage(func(img image.Image, ctx *ProxyCtx) image.Image {
271271
return football
272272
})
273273

274-
resp, err := client.Get(localFile("panda.png"))
274+
resp, err := client.Get(localFile("test_data/panda.png"))
275275
if err != nil {
276276
t.Fatal("Cannot get panda.png",err)
277277
}
@@ -289,13 +289,13 @@ func TestImageHandler(t *testing.T) {
289289
var _ = client
290290
defer l.Close()
291291

292-
football := getImage("football.png", t)
292+
football := getImage("test_data/football.png", t)
293293

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 {
295295
return football
296296
})
297297

298-
resp, err := client.Get(localFile("panda.png"))
298+
resp, err := client.Get(localFile("test_data/panda.png"))
299299
if err != nil {
300300
t.Fatal("Cannot get panda.png",err)
301301
}
@@ -308,7 +308,7 @@ func TestImageHandler(t *testing.T) {
308308
}
309309

310310
// and again
311-
resp, err = client.Get(localFile("panda.png"))
311+
resp, err = client.Get(localFile("test_data/panda.png"))
312312
if err != nil {
313313
t.Fatal("Cannot get panda.png",err)
314314
}
@@ -332,7 +332,7 @@ func TestChangeResp(t *testing.T) {
332332
return resp
333333
})
334334

335-
resp,err := client.Get(localFile("panda.png"))
335+
resp,err := client.Get(localFile("test_data/panda.png"))
336336
if err != nil {
337337
t.Fatal(err)
338338
}
@@ -346,21 +346,21 @@ func TestReplaceImage(t *testing.T) {
346346
client, proxy, l := oneShotProxy(t)
347347
defer l.Close()
348348

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)
351351

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 {
353353
return football
354354
})
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 {
356356
return panda
357357
})
358358

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)))
360360
fatalOnErr(err,"decode panda",t)
361361
compareImage(football,imgByPandaReq,t)
362362

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)))
364364
fatalOnErr(err,"decode football",t)
365365
compareImage(panda,imgByFootballReq,t)
366366
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)