123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465 |
- package dao
- import (
- "context"
- "testing"
- "go-common/app/interface/main/web/model"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaokeyRkList(t *testing.T) {
- convey.Convey("keyRkList", t, func(ctx convey.C) {
- var (
- rid = int16(1)
- rankType = int(0)
- day = int(1)
- arcType = int(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := keyRkList(rid, rankType, day, arcType)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyRkListBak(t *testing.T) {
- convey.Convey("keyRkListBak", t, func(ctx convey.C) {
- var (
- rid = int16(0)
- rankType = int(0)
- day = int(0)
- arcType = int(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := keyRkListBak(rid, rankType, day, arcType)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyRkIndex(t *testing.T) {
- convey.Convey("keyRkIndex", t, func(ctx convey.C) {
- var (
- day = int(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := keyRkIndex(day)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyRkIndexBak(t *testing.T) {
- convey.Convey("keyRkIndexBak", t, func(ctx convey.C) {
- var (
- day = int(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := keyRkIndexBak(day)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyRkRegionList(t *testing.T) {
- convey.Convey("keyRkRegionList", t, func(ctx convey.C) {
- var (
- rid = int16(1)
- day = int(3)
- original = int(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := keyRkRegionList(rid, day, original)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyRkRegionListBak(t *testing.T) {
- convey.Convey("keyRkRegionListBak", t, func(ctx convey.C) {
- var (
- rid = int16(1)
- day = int(3)
- original = int(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := keyRkRegionListBak(rid, day, original)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyRkRecommendList(t *testing.T) {
- convey.Convey("keyRkRecommendList", t, func(ctx convey.C) {
- var (
- rid = int16(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := keyRkRecommendList(rid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyRkRecommendListBak(t *testing.T) {
- convey.Convey("keyRkRecommendListBak", t, func(ctx convey.C) {
- var (
- rid = int16(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := keyRkRecommendListBak(rid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyRkTagList(t *testing.T) {
- convey.Convey("keyRkTagList", t, func(ctx convey.C) {
- var (
- rid = int16(1)
- tagID = int64(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := keyRkTagList(rid, tagID)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyRkTagListBak(t *testing.T) {
- convey.Convey("keyRkTagListBak", t, func(ctx convey.C) {
- var (
- rid = int16(1)
- tagID = int64(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- p1 := keyRkTagListBak(rid, tagID)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoRankingCache(t *testing.T) {
- convey.Convey("RankingCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- rid = int16(1)
- rankType = int(1)
- day = int(3)
- arcType = int(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- data, err := d.RankingCache(c, rid, rankType, day, arcType)
- ctx.Convey("Then err should be nil.data should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.Printf("%+v", data)
- })
- })
- })
- }
- func TestDaoRankingBakCache(t *testing.T) {
- convey.Convey("RankingBakCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- rid = int16(1)
- rankType = int(1)
- day = int(3)
- arcType = int(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- data, err := d.RankingBakCache(c, rid, rankType, day, arcType)
- ctx.Convey("Then err should be nil.data should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.Printf("%+v", data)
- })
- })
- })
- }
- func TestDaoRankingIndexCache(t *testing.T) {
- convey.Convey("RankingIndexCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- day = int(3)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- arcs, err := d.RankingIndexCache(c, day)
- ctx.Convey("Then err should be nil.arcs should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.Printf("%+v", arcs)
- })
- })
- })
- }
- func TestDaoRankingIndexBakCache(t *testing.T) {
- convey.Convey("RankingIndexBakCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- day = int(3)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- arcs, err := d.RankingIndexBakCache(c, day)
- ctx.Convey("Then err should be nil.arcs should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.Printf("%+v", arcs)
- })
- })
- })
- }
- func TestDaoRankingRegionCache(t *testing.T) {
- convey.Convey("RankingRegionCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- rid = int16(1)
- day = int(3)
- original = int(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- arcs, err := d.RankingRegionCache(c, rid, day, original)
- ctx.Convey("Then err should be nil.arcs should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.Printf("%+v", arcs)
- })
- })
- })
- }
- func TestDaoRankingRegionBakCache(t *testing.T) {
- convey.Convey("RankingRegionBakCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- rid = int16(1)
- day = int(3)
- original = int(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- arcs, err := d.RankingRegionBakCache(c, rid, day, original)
- ctx.Convey("Then err should be nil.arcs should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.Printf("%+v", arcs)
- })
- })
- })
- }
- func TestDaoRankingRecommendCache(t *testing.T) {
- convey.Convey("RankingRecommendCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- rid = int16(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- arcs, err := d.RankingRecommendCache(c, rid)
- ctx.Convey("Then err should be nil.arcs should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.Printf("%+v", arcs)
- })
- })
- })
- }
- func TestDaoRankingRecommendBakCache(t *testing.T) {
- convey.Convey("RankingRecommendBakCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- rid = int16(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- arcs, err := d.RankingRecommendBakCache(c, rid)
- ctx.Convey("Then err should be nil.arcs should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.Printf("%+v", arcs)
- })
- })
- })
- }
- func TestDaoRankingTagCache(t *testing.T) {
- convey.Convey("RankingTagCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- rid = int16(0)
- tagID = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- arcs, err := d.RankingTagCache(c, rid, tagID)
- ctx.Convey("Then err should be nil.arcs should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.Printf("%+v", arcs)
- })
- })
- })
- }
- func TestDaoRankingTagBakCache(t *testing.T) {
- convey.Convey("RankingTagBakCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- rid = int16(0)
- tagID = int64(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- arcs, err := d.RankingTagBakCache(c, rid, tagID)
- ctx.Convey("Then err should be nil.arcs should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.Printf("%+v", arcs)
- })
- })
- })
- }
- func TestDaoSetRegionCustomCache(t *testing.T) {
- convey.Convey("SetRegionCustomCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- data = []*model.Custom{{Aid: 1111}, {Aid: 2222}}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.SetRegionCustomCache(c, data)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoRegionCustomCache(t *testing.T) {
- convey.Convey("RegionCustomCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.RegionCustomCache(c)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoRegionCustomBakCache(t *testing.T) {
- convey.Convey("RegionCustomBakCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := d.RegionCustomBakCache(c)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoSetRankingCache(t *testing.T) {
- convey.Convey("SetRankingCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- rid = int16(0)
- rankType = int(0)
- day = int(0)
- arcType = int(0)
- data = &model.RankData{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.SetRankingCache(c, rid, rankType, day, arcType, data)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSetRankingIndexCache(t *testing.T) {
- convey.Convey("SetRankingIndexCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- day = int(0)
- arcs = []*model.IndexArchive{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.SetRankingIndexCache(c, day, arcs)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSetRankingRegionCache(t *testing.T) {
- convey.Convey("SetRankingRegionCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- rid = int16(0)
- day = int(0)
- original = int(0)
- arcs = []*model.RegionArchive{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.SetRankingRegionCache(c, rid, day, original, arcs)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSetRankingRecommendCache(t *testing.T) {
- convey.Convey("SetRankingRecommendCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- rid = int16(0)
- arcs = []*model.IndexArchive{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.SetRankingRecommendCache(c, rid, arcs)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSetRankingTagCache(t *testing.T) {
- convey.Convey("SetRankingTagCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- rid = int16(0)
- tagID = int64(0)
- arcs = []*model.TagArchive{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := d.SetRankingTagCache(c, rid, tagID, arcs)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
|