1 Star 0 Fork 0

蔡风华 / dingtalkutils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
dingtalkutils_test.go 1.30 KB
一键复制 编辑 原始数据 按行查看 历史
package dingtalkutils
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestExists(t *testing.T) {
asserter := assert.New(t)
asserter.True(true)
webhook := "https://oapi.dingtalk.com/robot/send?access_token=cfe9ee228d4f04c48999388fbdedbb15e2b8f665b3789af4641b5e87416a0e93"
secret := "SEC6a1e3b51a22da3656cc55cc8eeac59973d793ef4ff7e9b8a864f892706a97c96"
data := make(map[string]interface{})
content := make(map[string]string)
text := "just for test"
content["content"] = text
data["msgtype"] = "text"
data["text"] = content
doErr := SendMapData(webhook, secret, data)
asserter.Nil(doErr)
data = make(map[string]interface{})
content = make(map[string]string)
text = "at some one for test"
content["content"] = text
data["msgtype"] = "text"
toAtMap := map[string]interface{}{
"atMobiles": []string{
"15870679047",
"18665922663",
},
"isAtAll": false,
}
data["text"] = content
data["at"] = toAtMap
doErr = SendMapData(webhook, secret, data)
asserter.Nil(doErr)
data = make(map[string]interface{})
content = make(map[string]string)
text = "at all for test"
content["content"] = text
data["msgtype"] = "text"
toAtMap = map[string]interface{}{
"isAtAll": true,
}
data["at"] = toAtMap
data["text"] = content
doErr = SendMapData(webhook, secret, data)
asserter.Nil(doErr)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/cfh008/dingtalkutils.git
git@gitee.com:cfh008/dingtalkutils.git
cfh008
dingtalkutils
dingtalkutils
master

搜索帮助