diff --git a/gin_test.go b/gin_test.go index 1a7afba6..57985dce 100644 --- a/gin_test.go +++ b/gin_test.go @@ -80,7 +80,6 @@ func setupHTMLGlob(t *testing.T, mode string, tls bool) func() { return func() {} } -//TODO func TestLoadHTMLGlob(t *testing.T) { td := setupHTMLGlob(t, DebugMode, false) res, err := http.Get("http://127.0.0.1:8888/test") @@ -107,6 +106,19 @@ func TestLoadHTMLGlob2(t *testing.T) { td() } +func TestLoadHTMLGlob3(t *testing.T) { + td := setupHTMLGlob(t, ReleaseMode, 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 TestLoadHTMLGlobUsingTLS(t *testing.T) { td := setupHTMLGlob(t, DebugMode, true) // Use InsecureSkipVerify for avoiding `x509: certificate signed by unknown authority` error @@ -191,6 +203,18 @@ func TestLoadHTMLFiles2(t *testing.T) { td() } +func TestLoadHTMLFiles3(t *testing.T) { + td := setupHTMLFiles(t, ReleaseMode, 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 TestLoadHTMLFilesUsingTLS(t *testing.T) { td := setupHTMLFiles(t, TestMode, true) // Use InsecureSkipVerify for avoiding `x509: certificate signed by unknown authority` error @@ -224,10 +248,6 @@ func TestLoadHTMLFilesFuncMap(t *testing.T) { td() } -func TestLoadHTMLReleaseMode(t *testing.T) { - -} - func TestAddRoute(t *testing.T) { router := New() router.addRoute("GET", "/", HandlersChain{func(_ *Context) {}})