go-common/app/job/main/activity/dao/bnj/wechat_test.go

30 lines
753 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package bnj
import (
"context"
"testing"
"github.com/smartystreets/goconvey/convey"
"gopkg.in/h2non/gock.v1"
)
func TestBnjSendWechat(t *testing.T) {
convey.Convey("SendWechat", t, func(ctx convey.C) {
var (
c = context.Background()
title = "【拜年祭必看!】拜年祭预约人数到达预警"
msg = "拜年祭预约人数即将到达50w请及时准备拜年祭抽奖事项。"
user = "wuhao02"
)
ctx.Convey("When everything gose positive", func(ctx convey.C) {
defer gock.OffAll()
httpMock("POST", _wechatURL).Reply(200).JSON(`{"RetCode":0}`)
err := d.SendWechat(c, title, msg, user)
ctx.Convey("Then err should be nil.", func(ctx convey.C) {
ctx.So(err, convey.ShouldBeNil)
})
})
})
}