From: Maytham Alsudany Bug-Debian: https://bugs.debian.org/1068497 Forwarded: no Subject: Use local image for test --- a/decode_encode_test.go +++ b/decode_encode_test.go @@ -8,7 +8,6 @@ "image/jpeg" "io/ioutil" "log" - "net/http" "os" "os/exec" "testing" @@ -16,7 +15,6 @@ const ( // a random 683x1024 441kb image - imageUrl = "https://farm1.staticflickr.com/47/139138903_3d9600174d_b_d.jpg" localFileName = "test.jpg" saveResized = false ) @@ -30,12 +28,6 @@ ) func init() { - // download test file if doesn't exist - if !PathExists(localFileName) { - d := httpDl(imageUrl) - err := ioutil.WriteFile(localFileName, d, 0644) - panicIfErr(err) - } d, err := ioutil.ReadFile(localFileName) if err != nil { log.Fatalf("ReadFile() failed with %q\n", err) @@ -53,15 +45,6 @@ imgCmyk = convertAndLoad("cmyk") } -func httpDl(uri string) []byte { - res, err := http.Get(uri) - panicIfErr(err) - d, err := ioutil.ReadAll(res.Body) - res.Body.Close() - panicIfErr(err) - return d -} - // treats any error (e.g. lack of access due to permissions) as non-existence func PathExists(path string) bool { _, err := os.Stat(path)