Add tests for client.NewClient()

This commit is contained in:
Juan Carlos Mejías Rodríguez 2019-08-07 12:02:41 -04:00
parent a7bfa6e0b0
commit 0f0eaa7c3f

View File

@ -24,6 +24,14 @@ func writeResponseBodyAsJson(w http.ResponseWriter, body map[string]interface{})
return return
} }
func TestNewClient(t *testing.T) {
validClient, err := NewClient(http.DefaultClient, Config{
Url: "http://validurl.com",
})
assert.NotNil(t, validClient)
assert.Nil(t, err)
}
func TestClientAuthenticates(t *testing.T) { func TestClientAuthenticates(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
var body map[string]interface{} var body map[string]interface{}