123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- package dao
- import (
- "context"
- "net/url"
- "testing"
- "go-common/app/admin/main/workflow/model"
- "go-common/app/admin/main/workflow/model/param"
- "go-common/library/ecode"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoBatchUperSpecial(t *testing.T) {
- convey.Convey("BatchUperSpecial", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mids = []int64{27515256}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- UperTagMap, err := d.BatchUperSpecial(c, mids)
- ctx.Convey("Then err should be nil.UperTagMap should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(UperTagMap, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoArchiveRPC(t *testing.T) {
- convey.Convey("ArchiveRPC", t, func(ctx convey.C) {
- var (
- c = context.Background()
- oids = []int64{1}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- archives, err := d.ArchiveRPC(c, oids)
- ctx.Convey("Then err should be nil.archives should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(archives, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoTagList(t *testing.T) {
- convey.Convey("TagList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- tags, err := d.TagList(c)
- ctx.Convey("Then err should be nil.tags should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(tags, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoCommonExtraInfo(t *testing.T) {
- convey.Convey("CommonExtraInfo", t, func(ctx convey.C) {
- var (
- c = context.Background()
- bid = int8(13)
- uri = "http://uat-manager.bilibili.co/x/admin/reply/internal/reply"
- ids = []int64{1}
- oids = []int64{1}
- eids = []int64{1}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- data, err := d.CommonExtraInfo(c, bid, uri, ids, oids, eids)
- ctx.Convey("Then err should be nil.data should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(data, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAccountInfoRPC(t *testing.T) {
- convey.Convey("AccountInfoRPC", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mids = []int64{1}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- authors := d.AccountInfoRPC(c, mids)
- ctx.Convey("Then authors should not be nil.", func(ctx convey.C) {
- ctx.So(authors, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddMoral(t *testing.T) {
- convey.Convey("AddMoral", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mids = []int64{1}
- gssp = ¶m.GroupStateSetParam{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.AddMoral(c, mids, gssp)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err.Error(), convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddBlock(t *testing.T) {
- convey.Convey("AddBlock", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mids = []int64{1}
- gssp = ¶m.GroupStateSetParam{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.AddBlock(c, mids, gssp)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoAddCreditBlockInfo(t *testing.T) {
- convey.Convey("AddCreditBlockInfo", t, func(ctx convey.C) {
- var (
- c = context.Background()
- bus map[int64]*model.Business
- gssp = ¶m.GroupStateSetParam{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.AddCreditBlockInfo(c, bus, gssp)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoAddCreditCase(t *testing.T) {
- convey.Convey("AddCreditCase", t, func(ctx convey.C) {
- var (
- c = context.Background()
- uv url.Values
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.AddCreditCase(c, uv)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldEqual, ecode.Int(56504))
- })
- })
- })
- }
- func TestDaoBlockNum(t *testing.T) {
- convey.Convey("BlockNum", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- sum, err := d.BlockNum(c, mid)
- ctx.Convey("Then err should be nil.sum should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(sum, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoBlockInfo(t *testing.T) {
- convey.Convey("BlockInfo", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- resp, err := d.BlockInfo(c, mid)
- ctx.Convey("Then err should be nil.resp should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(resp, convey.ShouldNotBeNil)
- })
- })
- })
- }
|