madon_test.go
author Roberto Santalla <roobre@roobre.es>
Sat, 20 Apr 2019 14:21:48 +0200
changeset 248 f287d505dfda
parent 138 23d3a518d0ad
permissions -rw-r--r--
Try to parse error string returned by server before falling back to generic message Closes #4

package madon

import (
	"testing"

	"github.com/sendgrid/rest"
	"github.com/stretchr/testify/assert"
)

func TestPrepareRequest(t *testing.T) {
	mc := &Client{
		Name:    "foo",
		ID:      "666",
		Secret:  "biiiip",
		APIBase: "http://example.com",
	}

	req, err := mc.prepareRequest("bar", rest.Get, nil)
	assert.NoError(t, err, "no error")
	assert.NotNil(t, req.Headers, "not nil")
}