-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnotification_test.go
54 lines (43 loc) · 1.11 KB
/
notification_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
52
53
54
package transloadit
import (
"strings"
"testing"
)
func TestListNotifications(t *testing.T) {
t.Parallel()
client := setup(t)
_, err := client.ListNotifications(ctx, &ListOptions{
PageSize: 3,
})
if err == nil {
t.Fatal("expected an error but got nil")
}
if !strings.Contains(err.Error(), "no longer available") {
t.Fatalf("unexpected error message: %v", err)
}
}
func TestReplayNotification(t *testing.T) {
t.Parallel()
client := setup(t)
// Create a Assembly to later replay its notifications
assembly := NewAssembly()
assembly.AddFile("image", "./fixtures/lol_cat.jpg")
assembly.AddStep("resize", map[string]interface{}{
"robot": "/image/resize",
"width": 75,
"height": 75,
})
assembly.NotifyURL = "https://transloadit.com/notify-url/"
info, err := client.StartAssembly(ctx, assembly)
if err != nil {
t.Fatal(err)
}
info, err = client.WaitForAssembly(ctx, info)
if err != nil {
t.Fatal(err)
}
// Test replay notification with custom notify URL
if err = client.ReplayNotification(ctx, info.AssemblyID, "https://transloadit.com/custom-notify"); err != nil {
t.Fatal(err)
}
}