123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- package dao
- import (
- "context"
- "testing"
- xtime "go-common/library/time"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoUpMcnSignStateOP(t *testing.T) {
- convey.Convey("UpMcnSignStateOP", t, func(ctx convey.C) {
- var (
- c = context.Background()
- signID = int64(0)
- state = int8(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- rows, err := d.UpMcnSignStateOP(c, signID, state)
- ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rows, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoUpMcnUpStateOP(t *testing.T) {
- convey.Convey("UpMcnUpStateOP", t, func(ctx convey.C) {
- var (
- c = context.Background()
- signUpID = int64(0)
- state = int8(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- rows, err := d.UpMcnUpStateOP(c, signUpID, state)
- ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rows, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoUpMcnSignPayExpOP(t *testing.T) {
- convey.Convey("UpMcnSignPayExpOP", t, func(ctx convey.C) {
- var (
- c = context.Background()
- signPayID = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- rows, err := d.UpMcnSignPayExpOP(c, signPayID)
- ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rows, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddMcnDataSummary(t *testing.T) {
- convey.Convey("AddMcnDataSummary", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mcnMid = int64(0)
- signID = int64(1)
- upCount = int64(0)
- fansCountAccumulate = int64(0)
- genDate xtime.Time
- )
- var _, err = d.db.Exec(c, "delete from mcn_data_summary where sign_id=? and generate_date='1970-01-01'", signID)
- if err != nil {
- t.Logf("err=%v", err)
- }
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.AddMcnDataSummary(c, mcnMid, signID, upCount, fansCountAccumulate, genDate)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoMcnSigns(t *testing.T) {
- convey.Convey("McnSigns", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- mss, err := d.McnSigns(c)
- ctx.Convey("Then err should be nil.mss should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(mss, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoMcnUps(t *testing.T) {
- convey.Convey("McnUps", t, func(ctx convey.C) {
- var (
- c = context.Background()
- offset = int64(0)
- limit = int64(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- ups, err := d.McnUps(c, offset, limit)
- ctx.Convey("Then err should be nil.ups should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(len(ups), convey.ShouldBeGreaterThanOrEqualTo,0)
- })
- })
- })
- }
- func TestDaoMcnSignPays(t *testing.T) {
- convey.Convey("McnSignPays", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- sps, err := d.McnSignPayWarns(c)
- ctx.Convey("Then err should be nil.sps should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(len(sps), convey.ShouldBeGreaterThanOrEqualTo, 0)
- })
- })
- })
- }
- func TestDaoMcnSignMids(t *testing.T) {
- convey.Convey("McnSignMids", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- msid, sids, err := d.McnSignMids(c)
- ctx.Convey("Then err should be nil.msid,sids should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(sids, convey.ShouldNotBeNil)
- ctx.So(msid, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoMcnUPCount(t *testing.T) {
- convey.Convey("McnUPCount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- signIDs = []int64{0}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- mmc, err := d.McnUPCount(c, signIDs)
- ctx.Convey("Then err should be nil.mmc should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(mmc, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoMcnUPMids(t *testing.T) {
- convey.Convey("McnUPMids", t, func(ctx convey.C) {
- var (
- c = context.Background()
- signIDs = []int64{0}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- mup, err := d.McnUPMids(c, signIDs)
- ctx.Convey("Then err should be nil.mup should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(mup, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoCrmUpMidsSum(t *testing.T) {
- convey.Convey("CrmUpMidsSum", t, func(ctx convey.C) {
- var (
- c = context.Background()
- upMids = []int64{0}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- count, err := d.CrmUpMidsSum(c, upMids)
- ctx.Convey("Then err should be nil.count should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(count, convey.ShouldNotBeNil)
- })
- })
- })
- }
|