123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346 |
- package dao
- import (
- "context"
- "testing"
- "go-common/app/service/main/favorite/model"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestGETANDSetUserRecentResourcesMc(t *testing.T) {
- var (
- mid = int64(76)
- typ = int8(2)
- c = context.Background()
- )
- convey.Convey("folderMcKey", t, func(ctx convey.C) {
- recents, err := d.UserRecentResourcesMc(c, typ, mid)
- ctx.So(err, convey.ShouldBeNil)
- err = d.SetUserRecentResourcesMc(c, typ, mid, recents)
- ctx.So(err, convey.ShouldBeNil)
- err = d.DelRecentResMc(c, typ, mid)
- ctx.So(err, convey.ShouldBeNil)
- })
- }
- func TestFavfolderMcKey(t *testing.T) {
- var (
- mid = int64(0)
- fid = int64(0)
- )
- convey.Convey("folderMcKey", t, func(ctx convey.C) {
- p1 := folderMcKey(mid, fid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestFavfsortMcKey(t *testing.T) {
- var (
- typ = int8(0)
- mid = int64(0)
- )
- convey.Convey("fsortMcKey", t, func(ctx convey.C) {
- p1 := fsortMcKey(typ, mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestFavrelationFidsKey(t *testing.T) {
- var (
- typ = int8(0)
- mid = int64(0)
- oid = int64(0)
- )
- convey.Convey("relationFidsKey", t, func(ctx convey.C) {
- p1 := relationFidsKey(typ, mid, oid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestFavoidCountKey(t *testing.T) {
- var (
- typ = int8(0)
- oid = int64(0)
- )
- convey.Convey("oidCountKey", t, func(ctx convey.C) {
- p1 := oidCountKey(typ, oid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestFavbatchOidsKey(t *testing.T) {
- var (
- typ = int8(0)
- mid = int64(0)
- )
- convey.Convey("batchOidsKey", t, func(ctx convey.C) {
- p1 := batchOidsKey(typ, mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestFavpingMC(t *testing.T) {
- var (
- c = context.TODO()
- )
- convey.Convey("pingMC", t, func(ctx convey.C) {
- err := d.pingMC(c)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestFavSetFoldersMc(t *testing.T) {
- var (
- c = context.TODO()
- vs = &model.Folder{}
- )
- convey.Convey("SetFoldersMc", t, func(ctx convey.C) {
- err := d.SetFoldersMc(c, vs)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestFavFoldersMc(t *testing.T) {
- var (
- c = context.TODO()
- fvmids = []*model.ArgFVmid{
- &model.ArgFVmid{
- Fid: 1,
- Vmid: 88888894,
- },
- }
- )
- convey.Convey("FoldersMc", t, func(ctx convey.C) {
- fs, missFvmids, err := d.FoldersMc(c, fvmids)
- ctx.Convey("Then err should be nil.fs,missFvmids should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(missFvmids, convey.ShouldNotBeNil)
- ctx.So(fs, convey.ShouldNotBeNil)
- })
- })
- }
- func TestFavFolderMc(t *testing.T) {
- var (
- c = context.TODO()
- typ = int8(0)
- mid = int64(0)
- fid = int64(0)
- )
- convey.Convey("FolderMc", t, func(ctx convey.C) {
- f, err := d.FolderMc(c, typ, mid, fid)
- ctx.Convey("Then err should be nil.f should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(f, convey.ShouldNotBeNil)
- })
- })
- }
- func TestFavDelFolderMc(t *testing.T) {
- var (
- c = context.TODO()
- typ = int8(0)
- mid = int64(0)
- fid = int64(0)
- )
- convey.Convey("DelFolderMc", t, func(ctx convey.C) {
- err := d.DelFolderMc(c, typ, mid, fid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestFavSetFolderSortMc(t *testing.T) {
- var (
- c = context.TODO()
- fst = &model.FolderSort{}
- )
- convey.Convey("SetFolderSortMc", t, func(ctx convey.C) {
- err := d.SetFolderSortMc(c, fst)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestFavFolderSortMc(t *testing.T) {
- var (
- c = context.TODO()
- typ = int8(0)
- mid = int64(0)
- )
- convey.Convey("FolderSortMc", t, func(ctx convey.C) {
- fst, err := d.FolderSortMc(c, typ, mid)
- ctx.Convey("Then err should be nil.fst should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(fst, convey.ShouldNotBeNil)
- })
- })
- }
- func TestFavDelFolderSortMc(t *testing.T) {
- var (
- c = context.TODO()
- typ = int8(0)
- mid = int64(0)
- )
- convey.Convey("DelFolderSortMc", t, func(ctx convey.C) {
- err := d.DelFolderSortMc(c, typ, mid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestFavSetRelaitonFidsMc(t *testing.T) {
- var (
- c = context.TODO()
- typ = int8(1)
- mid = int64(88888894)
- oid = int64(1)
- fids = []int64{1}
- )
- convey.Convey("SetRelaitonFidsMc", t, func(ctx convey.C) {
- err := d.SetRelaitonFidsMc(c, typ, mid, oid, fids)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestFavRelaitonFidsMc(t *testing.T) {
- var (
- c = context.TODO()
- typ = int8(1)
- mid = int64(88888894)
- oid = int64(1)
- )
- convey.Convey("RelaitonFidsMc", t, func(ctx convey.C) {
- fids, err := d.RelaitonFidsMc(c, typ, mid, oid)
- ctx.Convey("Then err should be nil.fids should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(fids, convey.ShouldNotBeNil)
- })
- })
- }
- func TestFavDelRelationFidsMc(t *testing.T) {
- var (
- c = context.TODO()
- typ = int8(0)
- mid = int64(0)
- oids = int64(0)
- )
- convey.Convey("DelRelationFidsMc", t, func(ctx convey.C) {
- err := d.DelRelationFidsMc(c, typ, mid, oids)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestFavSetOidCountMc(t *testing.T) {
- var (
- c = context.TODO()
- typ = int8(0)
- oid = int64(0)
- count = int64(0)
- )
- convey.Convey("SetOidCountMc", t, func(ctx convey.C) {
- err := d.SetOidCountMc(c, typ, oid, count)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestFavOidCountMc(t *testing.T) {
- var (
- c = context.TODO()
- typ = int8(0)
- oid = int64(0)
- )
- convey.Convey("OidCountMc", t, func(ctx convey.C) {
- count, err := d.OidCountMc(c, typ, oid)
- 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)
- })
- })
- }
- func TestFavOidsCountMc(t *testing.T) {
- var (
- c = context.TODO()
- typ = int8(1)
- oids = []int64{1, 2, 3}
- )
- convey.Convey("OidsCountMc", t, func(ctx convey.C) {
- counts, misOids, err := d.OidsCountMc(c, typ, oids)
- ctx.Convey("Then err should be nil.counts,misOids should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(misOids, convey.ShouldNotBeNil)
- ctx.So(counts, convey.ShouldNotBeNil)
- })
- })
- }
- func TestFavSetOidsCountMc(t *testing.T) {
- var (
- c = context.TODO()
- typ = int8(0)
- cnts map[int64]int64
- )
- convey.Convey("SetOidsCountMc", t, func(ctx convey.C) {
- err := d.SetOidsCountMc(c, typ, cnts)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestFavBatchOidsMc(t *testing.T) {
- var (
- c = context.TODO()
- typ = int8(1)
- mid = int64(88888894)
- )
- convey.Convey("BatchOidsMc", t, func(ctx convey.C) {
- _, err := d.BatchOidsMc(c, typ, mid)
- ctx.Convey("Then err should be nil.oids should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestFavSetBatchOidsMc(t *testing.T) {
- var (
- c = context.TODO()
- typ = int8(1)
- mid = int64(88888894)
- oids = []int64{1, 2, 3}
- )
- convey.Convey("SetBatchOidsMc", t, func(ctx convey.C) {
- err := d.SetBatchOidsMc(c, typ, mid, oids)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
|