123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- package dao
- import (
- "context"
- "testing"
- "go-common/app/service/main/ugcpay-rank/internal/model"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoSetCacheElecUPRank(t *testing.T) {
- convey.Convey("SetCacheElecUPRank", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(233)
- ver = int64(0)
- val = &model.RankElecUPProto{
- CountUPTotalElec: 233,
- }
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := d.SetCacheElecUPRank(c, id, ver, val)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoCacheElecUPRank(t *testing.T) {
- convey.Convey("CacheElecUPRank", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(233)
- ver = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- res, err := d.CacheElecUPRank(c, id, ver)
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- res, err = d.CacheElecUPRank(c, 0, ver)
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoDelCacheElecUPRank(t *testing.T) {
- convey.Convey("DelCacheElecUPRank", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(233)
- ver = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := d.DelCacheElecUPRank(c, id, ver)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSetCacheElecAVRank(t *testing.T) {
- convey.Convey("SetCacheElecAVRank", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(233)
- val = &model.RankElecAVProto{
- CountUPTotalElec: 233,
- }
- ver = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := d.SetCacheElecAVRank(c, id, ver, val)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoCacheElecAVRank(t *testing.T) {
- convey.Convey("CacheElecAVRank", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(233)
- ver = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- res, err := d.CacheElecAVRank(c, id, ver)
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- res, err = d.CacheElecAVRank(c, 0, ver)
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoDelCacheElecAVRank(t *testing.T) {
- convey.Convey("DelCacheElecAVRank", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(233)
- ver = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := d.DelCacheElecAVRank(c, id, ver)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSetCacheElecPrepUPRank(t *testing.T) {
- convey.Convey("SetCacheElecPrepUPRank", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(233)
- val = &model.RankElecPrepUPProto{
- Count: 233,
- }
- ver = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := d.SetCacheElecPrepUPRank(c, id, ver, val)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoCacheElecPrepUPRank(t *testing.T) {
- convey.Convey("CacheElecPrepUPRank", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(233)
- ver = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- res, item, err := d.CacheElecPrepUPRank(c, id, ver)
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(item, convey.ShouldNotBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- res, item, err = d.CacheElecPrepUPRank(c, 0, ver)
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(item, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoDelCacheElecPrepUPRank(t *testing.T) {
- convey.Convey("DelCacheElecPrepUPRank", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(233)
- ver = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := d.DelCacheElecPrepUPRank(c, id, ver)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSetCacheElecPrepAVRank(t *testing.T) {
- convey.Convey("SetCacheElecPrepAVRank", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(233)
- val = &model.RankElecPrepAVProto{
- AVID: 233,
- }
- ver = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := d.SetCacheElecPrepAVRank(c, id, ver, val)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoCacheElecPrepAVRank(t *testing.T) {
- convey.Convey("CacheElecPrepAVRank", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(233)
- ver = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- res, item, err := d.CacheElecPrepAVRank(c, id, ver)
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(item, convey.ShouldNotBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- res, item, err = d.CacheElecPrepAVRank(c, 0, ver)
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(item, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoDelCacheElecPrepAVRank(t *testing.T) {
- convey.Convey("DelCacheElecPrepAVRank", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(233)
- ver = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := d.DelCacheElecPrepAVRank(c, id, ver)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoAddCacheElecPrepAVRank(t *testing.T) {
- convey.Convey("AddCacheElecPrepAVRank", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(233)
- val = &model.RankElecPrepAVProto{
- AVID: 233,
- }
- ver = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- ok, err := d.AddCacheElecPrepAVRank(c, id, ver, val)
- ctx.Convey("Then err should be nil.ok should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(ok, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddCacheElecPrepUPRank(t *testing.T) {
- convey.Convey("AddCacheElecPrepUPRank", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(233)
- val = &model.RankElecPrepUPProto{
- UPMID: 233,
- }
- ver = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- ok, err := d.AddCacheElecPrepUPRank(c, id, ver, val)
- ctx.Convey("Then err should be nil.ok should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(ok, convey.ShouldNotBeNil)
- })
- })
- })
- }
|