-
Notifications
You must be signed in to change notification settings - Fork 14
/
plans_test.go
36 lines (28 loc) · 867 Bytes
/
plans_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package bamboo_test
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
bamboo "github.com/rcarmstrong/go-bamboo"
)
func TestListPlans(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(unauthorizedStub))
defer ts.Close()
client := bamboo.NewSimpleClient(nil, "", "")
client.SetURL(ts.URL)
_, response, err := client.Plans.ListPlanKeys()
assert.Error(t, err)
assert.NotNil(t, response)
assert.Equal(t, http.StatusUnauthorized, response.StatusCode)
}
func TestListPlanNames(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(unauthorizedStub))
defer ts.Close()
client := bamboo.NewSimpleClient(nil, "", "")
client.SetURL(ts.URL)
_, response, err := client.Plans.ListPlanNames()
assert.Error(t, err)
assert.NotNil(t, response)
assert.Equal(t, http.StatusUnauthorized, response.StatusCode)
}