-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathingests_test.go
38 lines (32 loc) · 900 Bytes
/
ingests_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
37
38
package twch
import (
"fmt"
"net/http"
"reflect"
"testing"
)
func TestListIngests(t *testing.T) {
setup()
defer teardown()
mux.HandleFunc("/ingests", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
fmt.Fprint(w, `{ "_links": { "self": "h" }, "ingests": [ { "name": "n" , "default": false, "_id": 1, "url_template": "u", "availability":1.0 } ]}`)
})
got, resp, err := client.Ingests.ListIngests()
if err != nil {
t.Errorf("Ingests.ListIngests: returned error: %v", err)
}
testListResponse(t, resp, nil, nil, nil)
want := []Ingest{
Ingest{
Name: stringPtr("n"),
Default: boolPtr(false),
ID: intPtr(1),
URLTemplate: stringPtr("u"),
Availability: float32Ptr(1.0),
},
}
if !reflect.DeepEqual(got, want) {
t.Errorf("Ingests.ListIngests: response was wrong: %+v", got)
}
}