-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstance_test.go
More file actions
135 lines (123 loc) · 3.62 KB
/
Copy pathinstance_test.go
File metadata and controls
135 lines (123 loc) · 3.62 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package evolution_test
import (
"context"
"os"
"testing"
"github.com/verbeux-ai/evolution-client-go"
"github.com/stretchr/testify/require"
)
func TestCreateInstance(t *testing.T) {
ctx := context.Background()
result, err := client.CreateInstance(ctx, &evolution.CreateInstanceRequest{
InstanceName: os.Getenv("INSTANCE_NAME"),
Qrcode: false,
Integration: "WHATSAPP-BAILEYS",
RejectCall: false,
MsgCall: "",
GroupsIgnore: false,
AlwaysOnline: false,
ReadMessages: false,
ReadStatus: false,
SyncFullHistory: false,
ProxyHost: "",
ProxyPort: "",
ProxyProtocol: "",
ProxyUsername: "",
ProxyPassword: "",
Webhook: &evolution.CreateInstanceRequestWebhook{
Url: "https://webhook.site/89930b26-a76e-425b-a59f-36f925f0863c",
ByEvents: false,
Base64: true,
Headers: map[string]string{
"Content-Type": "application/json",
},
Events: []string{
"APPLICATION_STARTUP",
"QRCODE_UPDATED",
"MESSAGES_SET",
"MESSAGES_UPSERT",
"MESSAGES_UPDATE",
"MESSAGES_DELETE",
"SEND_MESSAGE",
"CONTACTS_SET",
"CONTACTS_UPSERT",
"CONTACTS_UPDATE",
"PRESENCE_UPDATE",
"CHATS_SET",
"CHATS_UPSERT",
"CHATS_UPDATE",
"CHATS_DELETE",
"GROUPS_UPSERT",
"GROUP_UPDATE",
"GROUP_PARTICIPANTS_UPDATE",
"CONNECTION_UPDATE",
"LABELS_EDIT",
"LABELS_ASSOCIATION",
"CALL",
"TYPEBOT_START",
"TYPEBOT_CHANGE_STATUS",
},
},
Rabbitmq: &evolution.CreateInstanceRequestRabbitMQ{},
Sqs: &evolution.CreateInstanceRequestSqs{},
ChatwootAccountId: "",
ChatwootToken: "",
ChatwootUrl: "",
ChatwootSignMsg: false,
ChatwootReopenConversation: false,
ChatwootConversationPending: false,
ChatwootImportContacts: false,
ChatwootNameInbox: "",
ChatwootMergeBrazilContacts: false,
ChatwootImportMessages: false,
ChatwootDaysLimitImportMessages: 0,
ChatwootOrganization: "",
ChatwootLogo: "",
})
require.NoError(t, err)
require.NotEmpty(t, result)
}
func TestRestartInstance(t *testing.T) {
ctx := context.Background()
result, err := client.RestartInstance(ctx, os.Getenv("INSTANCE_NAME"))
require.NoError(t, err)
require.NotEmpty(t, result)
}
func TestLogoutInstance(t *testing.T) {
ctx := context.Background()
result, err := client.LogoutInstance(ctx, os.Getenv("INSTANCE_NAME"))
require.NoError(t, err)
require.NotEmpty(t, result)
}
func TestDeleteInstance(t *testing.T) {
ctx := context.Background()
result, err := client.DeleteInstance(ctx, os.Getenv("INSTANCE_NAME"))
require.NoError(t, err)
require.NotEmpty(t, result)
}
func TestConnectInstance(t *testing.T) {
ctx := context.Background()
result, err := client.ConnectInstance(ctx, os.Getenv("INSTANCE_NAME"), "")
require.NoError(t, err)
require.NotEmpty(t, result)
}
func TestGetConnectionStateInstance(t *testing.T) {
ctx := context.Background()
result, err := client.ConnectionStateInstance(ctx, os.Getenv("INSTANCE_NAME"))
require.NoError(t, err)
require.NotEmpty(t, result)
}
func TestFetchInstances(t *testing.T) {
ctx := context.Background()
result, err := client.FetchInstances(ctx, nil)
require.NoError(t, err)
require.NotEmpty(t, result)
}
func TestFetchInstancesFiltered(t *testing.T) {
ctx := context.Background()
result, err := client.FetchInstances(ctx, &evolution.FetchInstancesRequestFilter{
InstanceName: "5459c0a2-a35f-11ef-bfad-aa807b84a752",
})
require.NoError(t, err)
require.NotEmpty(t, result)
}