im_test.go
1.1 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
package im
import (
"testing"
)
const (
IM_SERVICE_ADDRESS = "https://api.netease.im/nimserver"
IM_APP_KEY = "be7c0639c10e6a69f86ce3b4fa8dc8ec" //"ebf3ae278ee1b346773b99be5080f6a9"
IM_APP_SECRET = "9c5b60346613" //"67ea92e1ea45"
)
func TestCallCreate(t *testing.T) {
InitImClient(IM_SERVICE_ADDRESS, IM_APP_KEY, IM_APP_SECRET)
token, err := CallCreate(UserCreate{Accid: "1"})
if err != nil {
t.Fatal(err)
}
if token == nil {
t.Fatal("token is nil")
}
t.Log(token.Code, token.Info)
}
func TestCallRefreshToken(t *testing.T) {
InitImClient(IM_SERVICE_ADDRESS, IM_APP_KEY, IM_APP_SECRET)
token, err := CallRefreshToken(UserRefreshToken{Accid: "1"})
if err != nil {
t.Fatal(err)
}
if token == nil {
t.Fatal("token is nil")
}
t.Log(token.Code, token.Info)
}
func TestCallUpdate(t *testing.T) {
InitImClient(IM_SERVICE_ADDRESS, IM_APP_KEY, IM_APP_SECRET)
token, err := CallUpdate(UserUpdate{Accid: "1", Name: "tip tok"})
if err != nil {
t.Fatal(err)
}
if token == nil {
t.Fatal("token is nil")
}
t.Log(token.Code)
}