travis-ci updates

pull/443/head
Hunter Long 2020-03-18 19:57:59 -07:00
parent 7765075c27
commit cbabd2f8fa
1 changed files with 18 additions and 18 deletions

View File

@ -169,21 +169,21 @@ func TestDeleteDirectory(t *testing.T) {
}
func TestHttpRequest(t *testing.T) {
// Start a local HTTP server
server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
// Test request parameters
assert.Equal(t, req.URL.String(), "/")
assert.Equal(t, req.Header["Aaa"], []string{"bbbb="})
assert.Equal(t, req.Header["Ccc"], []string{"ddd"})
// Send response to be tested
rw.Write([]byte(`OK`))
}))
// Close the server when test finishes
defer server.Close()
body, resp, err := HttpRequest(server.URL, "GET", "application/json", []string{"aaa=bbbb=", "ccc=ddd"}, nil, 2*time.Second)
assert.Nil(t, err)
assert.Equal(t, []byte("OK"), body)
assert.Equal(t, resp.StatusCode, 200)
}
// Start a local HTTP server
server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
// Test request parameters
assert.Equal(t, req.URL.String(), "/")
assert.Equal(t, req.Header["Aaa"], []string{"bbbb="})
assert.Equal(t, req.Header["Ccc"], []string{"ddd"})
// Send response to be tested
rw.Write([]byte(`OK`))
}))
// Close the server when test finishes
defer server.Close()
body, resp, err := HttpRequest(server.URL, "GET", "application/json", []string{"aaa=bbbb=", "ccc=ddd"}, nil, 2*time.Second, false)
assert.Nil(t, err)
assert.Equal(t, []byte("OK"), body)
assert.Equal(t, resp.StatusCode, 200)
}