micro-account/pkg/common/wechat/tempate/template_test.go

47 lines
1.5 KiB
Go
Raw Normal View History

2025-02-20 08:18:23 +00:00
package tempate
import (
"github.com/fonchain_enterprise/micro-account/pkg/cache"
"github.com/fonchain_enterprise/micro-account/pkg/common/wechat"
"testing"
)
func TestSendWechatTemplateMsg(t *testing.T) {
redisConfig := cache.RedisConfig{
RedisDB: "1",
RedisAddr: "r-bp1mjimyh1ejg1mxclpd.redis.rds.aliyuncs.com:6379",
RedisPw: "fonchain_opv:kP6tW4tS3qB2dW4aE6uI5cX2",
RedisDbName: "1",
}
cache.LoadRedis(redisConfig)
type args struct {
appID string
appSecret string
templateId string
openId string
operatedAt string
Name string
address string
clockType string
}
tests := []struct {
name string
args args
wantErr bool
}{
{args: args{appID: "wx72ffc6670d5ddb12", appSecret: "50bec0ef9a7883de5b2fb3a74b23aff4", templateId: "alklszCrWJsueAOFwdlrvo2rN-XXwHqE_oHl_55kQmo", openId: "o_ath6SpAdmfaLeZD8v1mc_c-XxU", operatedAt: "2023-07-18 13:48:12", Name: "耿阳", address: "顾廷龙", clockType: "off"}},
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := SendWechatTemplateMsg(wechat.Wechat{Appid: tt.args.appID, AppSecret: tt.args.appSecret}, ClockInTemplateMsgInfo{TemplateId: tt.args.templateId, OpenId: tt.args.openId, OperatedAt: tt.args.operatedAt, Name: tt.args.Name, Address: tt.args.address, ClockType: tt.args.clockType}); (err != nil) != tt.wantErr {
t.Errorf("SendWechatTemplateMsg() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}