-
Notifications
You must be signed in to change notification settings - Fork 37
/
api_user_test.go
138 lines (110 loc) · 3.49 KB
/
api_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
134
135
136
137
138
/*
* Copyright 2020 zhaoyunxing.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dingtalk
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/zhaoyunxing92/dingtalk/v2/request"
)
func TestDingTalk_CreateUser(t *testing.T) {
t.Skip()
user, err := client.CreateUser(request.NewCreateUser("张三", "15669019211", 554656655).Build())
assert.Nil(t, err)
assert.NotNil(t, user.User.UserId)
t.Log(user.User.UserId)
}
func TestDingTalk_UpdateUser(t *testing.T) {
t.Skip()
res, err := client.UpdateUser(
request.NewUpdateUser("1948546245774889").
SetName("李四").
// SetDept(1, 560935057).
// SetTelephone("").
// SetForceUpdateFields("title,userid,title,userid").
// SetDeptTitle(1, "普通员工").
// SetDeptTitle(554656655, "设计人员").
// SetJobNumber("").
Build())
assert.Nil(t, err)
assert.NotNil(t, res.Code)
}
func TestDingTalk_DeleteUser(t *testing.T) {
t.Skip()
res, err := client.DeleteUser("1948546245774889")
assert.Nil(t, err)
assert.NotNil(t, res.Code)
assert.NotNil(t, res.RequestId)
}
func TestDingTalk_GetUserDetail(t *testing.T) {
detail, err := client.GetUserDetail(request.NewUserDetail("manager164").Build())
assert.Nil(t, err)
assert.NotNil(t, detail.Code)
assert.NotNil(t, detail.RequestId)
assert.NotNil(t, detail.Name)
assert.NotNil(t, detail.UnionId)
assert.NotNil(t, detail.UserId)
}
func TestDingTalk_GetUserCount(t *testing.T) {
req, err := client.GetUserCount(request.NewUserCount(true))
assert.Nil(t, err)
assert.NotNil(t, req.Result.Count)
}
func TestDingTalk_GetInactiveUser(t *testing.T) {
req, err := client.GetInactiveUser(
request.NewInactiveUser(true, 0, 10, "20211103").
Build())
assert.Nil(t, err)
assert.NotNil(t, req)
}
func TestDingTalk_GetUserIdByMobile(t *testing.T) {
req, err := client.GetUserIdByMobile(request.NewMobileGetUserId("18357154439"))
assert.Nil(t, err)
assert.NotNil(t, req.Result.UserId)
}
func TestDingTalk_GetUserIdByUnionId(t *testing.T) {
t.Skip()
req, err := client.GetUserIdByUnionId(request.NewUnionIdGetUserId("DmJWoRm5zkjT9kWWgVpm0giEiE"))
assert.Nil(t, err)
assert.NotNil(t, req.Result.UserId)
}
func TestDingTalk_GetOrgAdminUser(t *testing.T) {
req, err := client.GetOrgAdminUser()
assert.Nil(t, err)
assert.NotNil(t, req.AdminUser)
}
func TestDingTalk_GetOrgAdminScope(t *testing.T) {
req, err := client.GetOrgAdminScope(request.NewAdminUserScope("manager164"))
assert.Nil(t, err)
assert.NotNil(t, req.DeptIds)
}
func TestDingTalk_GetUserCanAccessApplet(t *testing.T) {
t.Skip()
req, err := client.GetUserCanAccessApplet(1244553273, "manager164")
assert.Nil(t, err)
assert.NotNil(t, req.Access)
}
func TestDingTalk_GetUserInfoByCode(t *testing.T) {
t.Skip()
req, err := client.GetUserInfoByCode("19f4d6df07b63bcf910f91cbe26b4c66")
assert.Nil(t, err)
assert.NotNil(t, req)
}
func TestDingTalk_GetSSOUserInfo(t *testing.T) {
t.Skip()
req, err := client.GetSSOUserInfo("4d878735fab43af2bfabe6af990856b3")
assert.Nil(t, err)
assert.NotNil(t, req)
}