-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact_user_test.go
133 lines (117 loc) · 2.68 KB
/
contact_user_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
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
package godingtalk
import (
"fmt"
"math/rand"
"os"
"testing"
"time"
)
var (
client = NewDingtalkClient(os.Getenv("APPKEY"), os.Getenv("APPSECRET"))
)
func init() {
if err := client.Init(); err != nil {
panic(err)
}
}
func TestOapiAuthScopesRequest(t *testing.T) {
resp, err := client.OapiAuthScopesRequest()
if err != nil {
t.Error(err)
}
fmt.Println(resp)
}
func random(min, max int) int {
rand.Seed(time.Now().Unix())
return rand.Intn(max-min) + min
}
func TestOapiGetUserRequest(t *testing.T) {
for i := 0; i < 20 ; i++ {
if i == 4 {
client.AccessToken.ExpiresTime = 10000000
}
time.Sleep(1 * time.Second)
resp, err := client.OapiUserGetRequest("1519491135941375")
if err != nil {
t.Error(err.Error() + "ssssss")
}
fmt.Printf("%#v\n", resp.Name)
}
}
// 105372678
func TestUserGetDeptMemberReques(t *testing.T) {
for i := 0; i < 20; i++ {
if i == 4 {
client.AccessToken.ExpiresTime = client.AccessToken.ExpiresTime - 7200 - 100 - 100
}
if i == 16 {
client.AccessToken.ExpiresTime = client.AccessToken.ExpiresTime - 7200 - 100 - 100
}
resp, err := client.OapiUserGetDeptMemberRequest("105372678")
if err != nil {
t.Error(err)
}
fmt.Println(resp)
}
}
func TestOapiUserSimplelistRequest(t *testing.T) {
for i:=0; i < 20 ; i ++ {
if i == 1 || i == 3 || i == 15 {
client.AccessToken.ExpiresTime = 0
}
resp, err := client.OapiUserSimplelistRequest("105372678", 0, 10, "entry_asc")
if err != nil {
t.Error(err)
}
fmt.Println(resp)
}
}
func TestOapiUserListbypageRequest(t *testing.T) {
resp, err := client.OapiUserListbypageRequest("105372678", 0, 10, "entry_asc")
if err != nil {
t.Error(err)
}
fmt.Println(resp)
}
func TestOapiUserGetAdminRequest(t *testing.T) {
resp, err := client.OapiUserGetAdminRequest()
if err != nil {
t.Error(err)
}
fmt.Println(resp)
}
func TestOapiUserGetAdminScopeRequest(t *testing.T) {
resp, err := client.OapiUserGetAdminScopeRequest("2749481918775803")
if err != nil {
t.Error(err)
}
fmt.Println(resp)
}
func TestOapiUserGetUseridByUnionidReques(t *testing.T) {
resp, err := client.OapiUserGetUseridByUnionidRequest("xxxx")
if err != nil {
t.Error(err)
}
fmt.Println(resp)
}
func TestOapiUserGetByMobileRequest(t *testing.T) {
resp, err := client.OapiUserGetByMobileRequest("17608035126")
if err != nil {
t.Error(err)
}
fmt.Println(resp)
}
func TestOapiUserGetOrgUserCountRequest(t *testing.T) {
resp, err := client.OapiUserGetOrgUserCountRequest("1")
if err != nil {
t.Error(err)
}
fmt.Println(resp)
}
func TestOapiInactiveUserGetRequest(t *testing.T) {
resp, err := client.OapiInactiveUserGetRequest("20200503", "0", "100")
if err != nil {
t.Error(err)
}
fmt.Println(resp)
}