go-common/app/job/main/activity/dao/bnj/wechat_test.go
2019-04-22 18:49:16 +08:00

30 lines
753 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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)
})
})
})
}