Fix issue with failing TestMode

This commit is contained in:
math-nao 2018-03-23 19:14:34 +01:00
parent ee02565f7c
commit f4515cbbe7
1 changed files with 14 additions and 18 deletions

View File

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