This repository has been archived by the owner on Sep 15, 2022. It is now read-only.
forked from zoom-lib-golang/zoom-lib-golang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeeting_test.go
98 lines (82 loc) · 2.01 KB
/
meeting_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
97
98
// +build integration
package zoom
import (
"os"
"testing"
)
func TestListMeetings(t *testing.T) {
var (
apiKey = os.Getenv("ZOOM_API_KEY")
apiSecret = os.Getenv("ZOOM_API_SECRET")
primaryUser = os.Getenv("ZOOM_EXAMPLE_EMAIL")
one = int(1)
)
APIKey = apiKey
APISecret = apiSecret
_, err := ListMeetings(ListMeetingsOptions{
HostID: primaryUser,
PageSize: &one,
PageNumber: &one,
})
if err != nil {
t.Fatalf("got error listing meetings: %+v\n", err)
}
}
func TestCreateGetDeleteMeeting(t *testing.T) {
var (
apiKey = os.Getenv("ZOOM_API_KEY")
apiSecret = os.Getenv("ZOOM_API_SECRET")
primaryUser = os.Getenv("ZOOM_EXAMPLE_EMAIL")
)
APIKey = apiKey
APISecret = apiSecret
user, err := GetUser(GetUserOpts{EmailOrID: primaryUser})
if err != nil {
t.Fatalf("got error listing users: %+v\n", err)
}
meeting, err := CreateMeeting(CreateMeetingOptions{
HostID: user.ID,
Topic: "This is a test meeting created by zoom-lib-golang",
Agenda: "This important topic will be discussed",
Type: MeetingTypeInstant,
Settings: MeetingSettings{
Audio: AudioBoth,
HostVideo: true,
ParticipantVideo: false,
JoinBeforeHost: true,
EnforceLogin: true,
},
})
if err != nil {
t.Fatalf("got error creating meeting: %+v\n", err)
}
meeting, err = GetMeeting(GetMeetingOptions{
MeetingID: meeting.ID,
})
if err != nil {
t.Fatalf("got error getting meeting: %+v\n", err)
}
err = DeleteMeeting(DeleteMeetingOptions{
MeetingID: meeting.ID,
})
if err != nil {
t.Fatalf("got error getting meeting: %+v\n", err)
}
}
func TestDeleteMeetingFail(t *testing.T) {
var (
apiKey = os.Getenv("ZOOM_API_KEY")
apiSecret = os.Getenv("ZOOM_API_SECRET")
)
APIKey = apiKey
APISecret = apiSecret
err := DeleteMeeting(DeleteMeetingOptions{
MeetingID: 1234,
})
if err == nil {
t.Fatalf("did not get error getting meeting: %+v\n", err)
}
if err.Error() != "404 Not Found" {
t.Errorf("Expected 404 Not Found. Actual: %v\n", err)
}
}