123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408 |
- package dao
- import (
- "context"
- "go-common/app/job/main/vip/model"
- xtime "go-common/library/time"
- "testing"
- "time"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoAddChangeHistoryBatch(t *testing.T) {
- convey.Convey("AddChangeHistoryBatch", t, func(ctx convey.C) {
- var (
- res = []*model.VipChangeHistory{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.AddChangeHistoryBatch(res)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelChangeHistory(t *testing.T) {
- convey.Convey("SelChangeHistory", t, func(ctx convey.C) {
- var (
- c = context.Background()
- startID = int64(0)
- endID = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelChangeHistory(c, startID, endID)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelOldChangeHistory(t *testing.T) {
- convey.Convey("SelOldChangeHistory", t, func(ctx convey.C) {
- var (
- c = context.Background()
- startID = int64(0)
- endID = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelOldChangeHistory(c, startID, endID)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelOldChangeHistoryMaxID(t *testing.T) {
- convey.Convey("SelOldChangeHistoryMaxID", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelOldChangeHistoryMaxID(c)
- ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelChangeHistoryMaxID(t *testing.T) {
- convey.Convey("SelChangeHistoryMaxID", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelChangeHistoryMaxID(c)
- ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoVipStatus(t *testing.T) {
- convey.Convey("VipStatus", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.VipStatus(c, mid)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelMaxID(t *testing.T) {
- convey.Convey("SelMaxID", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelMaxID(c)
- ctx.Convey("Then err should be nil.mID should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoUpdateVipUserInfo(t *testing.T) {
- convey.Convey("UpdateVipUserInfo", t, func(ctx convey.C) {
- var (
- r = &model.VipUserInfo{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- tx, err := d.StartTx(context.Background())
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(tx, convey.ShouldNotBeNil)
- _, err = d.UpdateVipUserInfo(tx, r)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoUpdateVipUser(t *testing.T) {
- convey.Convey("UpdateVipUser", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- status = int8(0)
- vipType = int8(0)
- payType = int8(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.UpdateVipUser(c, mid, status, vipType, payType)
- ctx.Convey("Then err should be nil.eff should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoDupUserDiscountHistory(t *testing.T) {
- convey.Convey("DupUserDiscountHistory", t, func(ctx convey.C) {
- var (
- r = &model.VipUserDiscountHistory{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- tx, err := d.StartTx(context.Background())
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(tx, convey.ShouldNotBeNil)
- _, err = d.DupUserDiscountHistory(tx, r)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoAddUserInfo(t *testing.T) {
- convey.Convey("AddUserInfo", t, func(ctx convey.C) {
- var (
- r = &model.VipUserInfo{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- tx, err := d.StartTx(context.Background())
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(tx, convey.ShouldNotBeNil)
- _, err = d.AddUserInfo(tx, r)
- ctx.Convey("Then err should be nil.eff should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelVipUserInfo(t *testing.T) {
- convey.Convey("SelVipUserInfo", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelVipUserInfo(c, mid)
- ctx.Convey("Then err should be nil.r should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoUpdateUserInfo(t *testing.T) {
- convey.Convey("UpdateUserInfo", t, func(ctx convey.C) {
- var (
- r = &model.VipUserInfo{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- tx, err := d.StartTx(context.Background())
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(tx, convey.ShouldNotBeNil)
- _, err = d.UpdateUserInfo(tx, r)
- ctx.Convey("Then err should be nil.eff should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelUserDiscountMaxID(t *testing.T) {
- convey.Convey("SelUserDiscountMaxID", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelUserDiscountMaxID(c)
- ctx.Convey("Then err should be nil.maxID should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelUserDiscountHistorys(t *testing.T) {
- convey.Convey("SelUserDiscountHistorys", t, func(ctx convey.C) {
- var (
- c = context.Background()
- sID = int(0)
- eID = int(0)
- discountID = int(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelUserDiscountHistorys(c, sID, eID, discountID)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelOldUserInfoMaxID(t *testing.T) {
- convey.Convey("SelOldUserInfoMaxID", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelOldUserInfoMaxID(c)
- ctx.Convey("Then err should be nil.maxID should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelUserInfoMaxID(t *testing.T) {
- convey.Convey("SelUserInfoMaxID", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelUserInfoMaxID(c)
- ctx.Convey("Then err should be nil.maxID should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelUserInfos(t *testing.T) {
- convey.Convey("SelUserInfos", t, func(ctx convey.C) {
- var (
- c = context.Background()
- sID = int(0)
- eID = int(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelUserInfos(c, sID, eID)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelVipList(t *testing.T) {
- convey.Convey("SelVipList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int(0)
- endID = int(0)
- ot = ""
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelVipList(c, id, endID, ot)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelVipUsers(t *testing.T) {
- convey.Convey("SelVipUsers", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int(0)
- endID = int(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelVipUsers(c, id, endID, xtime.Time(time.Now().Unix()), xtime.Time(time.Now().Unix()))
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelVipUserInfos(t *testing.T) {
- convey.Convey("SelVipUserInfos", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int(0)
- endID = int(0)
- status = int(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelVipUserInfos(c, id, endID, xtime.Time(time.Now().Unix()), xtime.Time(time.Now().Unix()), status)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoOldVipInfo(t *testing.T) {
- convey.Convey("OldVipInfo", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.OldVipInfo(c, mid)
- ctx.Convey("Then err should be nil.r should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelEffectiveScopeVipList(t *testing.T) {
- convey.Convey("SelEffectiveScopeVipList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int(0)
- endID = int(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelEffectiveScopeVipList(c, id, endID)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSelOldUserInfoMaps(t *testing.T) {
- convey.Convey("SelOldUserInfoMaps", t, func(ctx convey.C) {
- var (
- c = context.Background()
- sID = int(0)
- eID = int(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- _, err := d.SelOldUserInfoMaps(c, sID, eID)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func Test_SelChangeHistoryMaps(t *testing.T) {
- convey.Convey("SelChangeHistoryMaps", t, func(ctx convey.C) {
- _, err := d.SelChangeHistoryMaps(context.Background(), []int64{7593623})
- ctx.So(err, convey.ShouldBeNil)
- })
- }
- func Test_SelOldChangeHistoryMaps(t *testing.T) {
- convey.Convey("SelOldChangeHistoryMaps", t, func(ctx convey.C) {
- _, err := d.SelOldChangeHistoryMaps(context.Background(), []int64{7593623})
- ctx.So(err, convey.ShouldBeNil)
- })
- }
- func Test_SelVipByIds(t *testing.T) {
- convey.Convey("SelVipByIds", t, func(ctx convey.C) {
- _, err := d.SelVipByIds(context.Background(), []int64{7593623})
- ctx.So(err, convey.ShouldBeNil)
- })
- }
|