-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsources_test.go
More file actions
38 lines (30 loc) · 858 Bytes
/
sources_test.go
File metadata and controls
38 lines (30 loc) · 858 Bytes
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
37
38
package lever
import (
"context"
"net/http"
"testing"
"github.com/corbaltcode/lever-data-api-go/internal/testclient"
"github.com/stretchr/testify/assert"
)
func TestSources(t *testing.T) {
s := testclient.NewExpectManyHandler(
testclient.NewExpectHandler(
http.StatusOK,
`{"data":[{"text":"Gild","count":24},{"text":"Posting","count":51},{"text":"Referral","count":90},{"text":"Email Applicant","count":135},{"text":"Email Lead","count":83}]}`,
testclient.ExpectMethod(http.MethodGet),
testclient.ExpectPath("/v1/sources"),
),
)
httpClient := http.Client{
Transport: s,
}
ta := assert.New(t)
c := NewClient(WithHTTPClient(&httpClient))
ctx := context.Background()
// List sources
listReq := NewListSourcesRequest()
listResp, err := c.ListSources(ctx, listReq)
if ta.NoError(err) {
ta.Len(listResp.Sources, 5)
}
}