From f4515cbbe7d7842e20ca5d86696b64506899f1a2 Mon Sep 17 00:00:00 2001 From: math-nao Date: Fri, 23 Mar 2018 19:14:34 +0100 Subject: [PATCH] Fix issue with failing TestMode --- gin_test.go | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/gin_test.go b/gin_test.go index 2acfbd9c..32c44243 100644 --- a/gin_test.go +++ b/gin_test.go @@ -278,19 +278,6 @@ func TestLoadHTMLFilesFuncMap(t *testing.T) { } func TestLoadHTMLFilesRecursively(t *testing.T) { - td := setupHTMLFilesRecursively(t, DebugMode, false) - res, err := http.Get("http://127.0.0.1:8888/test") - if err != nil { - fmt.Println(err) - } - - resp, _ := ioutil.ReadAll(res.Body) - assert.Equal(t, "

Hello world

", string(resp[:])) - - td() -} - -func TestLoadHTMLFilesRecursively2(t *testing.T) { td := setupHTMLFilesRecursively(t, TestMode, false) res, err := http.Get("http://127.0.0.1:8888/test") if err != nil { @@ -299,7 +286,18 @@ func TestLoadHTMLFilesRecursively2(t *testing.T) { resp, _ := ioutil.ReadAll(res.Body) assert.Equal(t, "

Hello world

", string(resp[:])) + td() +} +func TestLoadHTMLFilesRecursively2(t *testing.T) { + td := setupHTMLFilesRecursively(t, DebugMode, false) + res, err := http.Get("http://127.0.0.1:8888/test") + if err != nil { + fmt.Println(err) + } + + resp, _ := ioutil.ReadAll(res.Body) + assert.Equal(t, "

Hello world

", string(resp[:])) td() } @@ -312,12 +310,11 @@ func TestLoadHTMLFilesRecursively3(t *testing.T) { resp, _ := ioutil.ReadAll(res.Body) assert.Equal(t, "

Hello world

", string(resp[:])) - td() } func TestLoadHTMLFilesRecursivelyUsingTLS(t *testing.T) { - td := setupHTMLFilesRecursively(t, DebugMode, true) + td := setupHTMLFilesRecursively(t, TestMode, true) // Use InsecureSkipVerify for avoiding `x509: certificate signed by unknown authority` error tr := &http.Transport{ TLSClientConfig: &tls.Config{ @@ -332,13 +329,12 @@ func TestLoadHTMLFilesRecursivelyUsingTLS(t *testing.T) { resp, _ := ioutil.ReadAll(res.Body) assert.Equal(t, "

Hello world

", string(resp[:])) - td() } -func TestLoadHTMLFilesRecursivelyFromFuncMap(t *testing.T) { +func TestLoadHTMLFilesRecursivelyFuncMap(t *testing.T) { time.Now() - td := setupHTMLFilesRecursively(t, DebugMode, false) + td := setupHTMLFilesRecursively(t, TestMode, false) res, err := http.Get("http://127.0.0.1:8888/raw") if err != nil { fmt.Println(err)