123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- package dao
- import (
- "context"
- "go-common/app/service/main/relation/model"
- xtime "go-common/library/time"
- "time"
- "testing"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaotagsKey(t *testing.T) {
- var (
- mid = int64(0)
- )
- convey.Convey("tagsKey", t, func(ctx convey.C) {
- p1 := tagsKey(mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaofollowingsKey(t *testing.T) {
- var (
- mid = int64(0)
- )
- convey.Convey("followingsKey", t, func(ctx convey.C) {
- p1 := followingsKey(mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoAddFollowingCache(t *testing.T) {
- var (
- c = context.Background()
- mid = int64(0)
- following = &model.Following{}
- )
- convey.Convey("AddFollowingCache", t, func(ctx convey.C) {
- err := d.AddFollowingCache(c, mid, following)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoDelFollowing(t *testing.T) {
- var (
- c = context.Background()
- mid = int64(0)
- following = &model.Following{}
- )
- convey.Convey("DelFollowing", t, func(ctx convey.C) {
- err := d.DelFollowing(c, mid, following)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoencode(t *testing.T) {
- var (
- attribute = uint32(0)
- mtime = xtime.Time(time.Now().Unix())
- tagids = []int64{}
- special = int32(0)
- )
- convey.Convey("encode", t, func(ctx convey.C) {
- res, err := d.encode(attribute, mtime, tagids, special)
- 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 TestDaofollowingKey(t *testing.T) {
- var (
- mid = int64(0)
- )
- convey.Convey("followingKey", t, func(ctx convey.C) {
- p1 := followingKey(mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaotagCountKey(t *testing.T) {
- var (
- mid = int64(0)
- )
- convey.Convey("tagCountKey", t, func(ctx convey.C) {
- p1 := tagCountKey(mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoDelFollowingCache(t *testing.T) {
- var (
- c = context.Background()
- mid = int64(0)
- )
- convey.Convey("DelFollowingCache", t, func(ctx convey.C) {
- err := d.DelFollowingCache(c, mid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaodelFollowingCache(t *testing.T) {
- var (
- c = context.Background()
- key = ""
- )
- convey.Convey("delFollowingCache", t, func(ctx convey.C) {
- err := d.delFollowingCache(c, key)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoDelTagCountCache(t *testing.T) {
- var (
- c = context.Background()
- mid = int64(0)
- )
- convey.Convey("DelTagCountCache", t, func(ctx convey.C) {
- err := d.DelTagCountCache(c, mid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoDelTagsCache(t *testing.T) {
- var (
- c = context.Background()
- mid = int64(0)
- )
- convey.Convey("DelTagsCache", t, func(ctx convey.C) {
- err := d.DelTagsCache(c, mid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
|