mirror of https://github.com/gin-gonic/gin.git
Fix issue with failing TestMode
This commit is contained in:
parent
ee02565f7c
commit
f4515cbbe7
32
gin_test.go
32
gin_test.go
|
@ -278,19 +278,6 @@ func TestLoadHTMLFilesFuncMap(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoadHTMLFilesRecursively(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, "<h1>Hello world</h1>", string(resp[:]))
|
|
||||||
|
|
||||||
td()
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestLoadHTMLFilesRecursively2(t *testing.T) {
|
|
||||||
td := setupHTMLFilesRecursively(t, TestMode, false)
|
td := setupHTMLFilesRecursively(t, TestMode, false)
|
||||||
res, err := http.Get("http://127.0.0.1:8888/test")
|
res, err := http.Get("http://127.0.0.1:8888/test")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -299,7 +286,18 @@ func TestLoadHTMLFilesRecursively2(t *testing.T) {
|
||||||
|
|
||||||
resp, _ := ioutil.ReadAll(res.Body)
|
resp, _ := ioutil.ReadAll(res.Body)
|
||||||
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
|
assert.Equal(t, "<h1>Hello world</h1>", 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, "<h1>Hello world</h1>", string(resp[:]))
|
||||||
td()
|
td()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,12 +310,11 @@ func TestLoadHTMLFilesRecursively3(t *testing.T) {
|
||||||
|
|
||||||
resp, _ := ioutil.ReadAll(res.Body)
|
resp, _ := ioutil.ReadAll(res.Body)
|
||||||
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
|
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
|
||||||
|
|
||||||
td()
|
td()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoadHTMLFilesRecursivelyUsingTLS(t *testing.T) {
|
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
|
// Use InsecureSkipVerify for avoiding `x509: certificate signed by unknown authority` error
|
||||||
tr := &http.Transport{
|
tr := &http.Transport{
|
||||||
TLSClientConfig: &tls.Config{
|
TLSClientConfig: &tls.Config{
|
||||||
|
@ -332,13 +329,12 @@ func TestLoadHTMLFilesRecursivelyUsingTLS(t *testing.T) {
|
||||||
|
|
||||||
resp, _ := ioutil.ReadAll(res.Body)
|
resp, _ := ioutil.ReadAll(res.Body)
|
||||||
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
|
assert.Equal(t, "<h1>Hello world</h1>", string(resp[:]))
|
||||||
|
|
||||||
td()
|
td()
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoadHTMLFilesRecursivelyFromFuncMap(t *testing.T) {
|
func TestLoadHTMLFilesRecursivelyFuncMap(t *testing.T) {
|
||||||
time.Now()
|
time.Now()
|
||||||
td := setupHTMLFilesRecursively(t, DebugMode, false)
|
td := setupHTMLFilesRecursively(t, TestMode, false)
|
||||||
res, err := http.Get("http://127.0.0.1:8888/raw")
|
res, err := http.Get("http://127.0.0.1:8888/raw")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
|
Loading…
Reference in New Issue