-
Notifications
You must be signed in to change notification settings - Fork 0
/
failed_deliveries_test.go
51 lines (44 loc) · 1.32 KB
/
failed_deliveries_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
39
40
41
42
43
44
45
46
47
48
49
50
51
package addyapi
import (
"fmt"
"net/http"
"testing"
)
func TestFailedDeliveriesGet(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/api/v1/failed-deliveries", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
fmt.Fprint(w, fixture("failed_deliveries/get_all.json"))
})
_, err := client.FailedDeliveriesGet()
if err != nil {
t.Fatal(err)
}
}
func TestFailedDeliveryGet(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/api/v1/failed-deliveries/46eebc50-f7f8-46d7-beb9-c37f04c29a84", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
fmt.Fprint(w, fixture("failed_deliveries/get_specific.json"))
})
_, err := client.FailedDeliveryGet("46eebc50-f7f8-46d7-beb9-c37f04c29a84")
if err != nil {
t.Fatal(err)
}
}
func TestFailedDeliveryDel(t *testing.T) {
teardown := setup()
defer teardown()
mux.HandleFunc("/api/v1/failed-deliveries/46eebc50-f7f8-46d7-beb9-c37f04c29a84", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
})
err := client.FailedDeliveryDel("46eebc50-f7f8-46d7-beb9-c37f04c29a84")
if err != nil {
t.Fatal(err)
}
}