-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
scheduledEvents_test.go
96 lines (82 loc) · 2.4 KB
/
scheduledEvents_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package calendly_test
import (
"testing"
"github.com/helixspiral/calendly"
)
func TestListEventInvitees(t *testing.T) {
cw := calendly.New(&calendly.CalendlyWrapperInput{
BaseApiUrl: "https://stoplight.io/mocks/calendly/api-docs/395/",
CustomHeaders: map[string]string{
"Prefer": "code=200",
},
})
invList, err := cw.ListEventInvitees(&calendly.ListEventInviteesInput{
ID: "AAAAAAAAAAAAAAAA",
Count: 1,
Email: "test@example.com",
PageToken: "test",
Sort: "created_at:asc",
Status: "active",
})
if err != nil {
t.Fatal("Failed to get invitee list:", err)
}
if invList[0].Name != "John Doe" {
t.Fatalf("Expected 'John Doe', received '%s'.", invList[0].Name)
}
}
func TestListEvents(t *testing.T) {
cw := calendly.New(&calendly.CalendlyWrapperInput{
BaseApiUrl: "https://stoplight.io/mocks/calendly/api-docs/395/",
CustomHeaders: map[string]string{
"Prefer": "code=200",
},
})
eventList, err := cw.ListEvents(&calendly.ListEventsInput{
Count: 1,
InviteeEmail: "user@example.com",
MaxStartTime: "2019-08-24T14:15:22Z",
MinStartTime: "2019-08-24T14:15:22Z",
Organization: "https://api.calendly.com/organization/AAAAAAAAAAAAAAAA",
PageToken: "test",
Sort: "created_at:asc",
Status: "active",
User: "https://api.calendly.com/users/AAAAAAAAAAAAAAAA",
})
if err != nil {
t.Fatal("Failed to get event list:", err)
}
if eventList[0].Name != "15 Minute Meeting" {
t.Fatalf("Expected '15 Minute Meeting', received '%s'.", eventList[0].Name)
}
}
func TestGetEventInvitee(t *testing.T) {
cw := calendly.New(&calendly.CalendlyWrapperInput{
BaseApiUrl: "https://stoplight.io/mocks/calendly/api-docs/395/",
CustomHeaders: map[string]string{
"Prefer": "code=200",
},
})
inv, err := cw.GetEventInvitee("test-event", "test-invitee")
if err != nil {
t.Fatal("Failed to get event:", err)
}
if inv.Name != "John Doe" {
t.Fatalf("Expected 'John Doe', received '%s'", inv.Name)
}
}
func TestGetEvent(t *testing.T) {
cw := calendly.New(&calendly.CalendlyWrapperInput{
BaseApiUrl: "https://stoplight.io/mocks/calendly/api-docs/395/",
CustomHeaders: map[string]string{
"Prefer": "code=200",
},
})
event, err := cw.GetEvent("test-event")
if err != nil {
t.Fatal("Failed to get event:", err)
}
if event.Name != "15 Minute Meeting" {
t.Fatalf("Expected '15 Minute Meeting', received '%s'", event.Name)
}
}