123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- package manager
- import (
- "context"
- "go-common/app/service/main/up/dao"
- "go-common/app/service/main/up/model"
- "testing"
- "time"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestManagerUpSpecials(t *testing.T) {
- var (
- c = context.TODO()
- )
- convey.Convey("UpSpecials", t, func(ctx convey.C) {
- ups, err := d.UpSpecials(c)
- ctx.Convey("Then err should be nil.ups should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(ups, convey.ShouldNotBeNil)
- })
- })
- }
- func TestManagerRefreshUpSpecialIncremental(t *testing.T) {
- var (
- c = context.TODO()
- lastMTime = time.Now()
- )
- convey.Convey("RefreshUpSpecialIncremental", t, func(ctx convey.C) {
- ups, err := d.RefreshUpSpecialIncremental(c, lastMTime)
- ctx.Convey("Then err should be nil.ups should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(len(ups), convey.ShouldBeGreaterThanOrEqualTo, 0)
- })
- })
- }
- func TestManagerDelSpecialByID(t *testing.T) {
- var (
- c = context.TODO()
- id = int64(0)
- )
- convey.Convey("DelSpecialByID", t, func(ctx convey.C) {
- res, err := d.DelSpecialByID(c, id)
- 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 TestManagerInsertSpecial(t *testing.T) {
- var (
- c = context.TODO()
- special = &model.UpSpecial{}
- mids = int64(0)
- )
- convey.Convey("InsertSpecial", t, func(ctx convey.C) {
- res, err := d.InsertSpecial(c, special, mids)
- 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 TestManagerUpdateSpecialByID(t *testing.T) {
- var (
- c = context.TODO()
- id = int64(0)
- special = &model.UpSpecial{}
- )
- convey.Convey("UpdateSpecialByID", t, func(ctx convey.C) {
- res, err := d.UpdateSpecialByID(c, id, 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 TestManagerGetSpecialByMidGroup(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(0)
- groupID = int64(0)
- )
- convey.Convey("GetSpecialByMidGroup", t, func(ctx convey.C) {
- res, err := d.GetSpecialByMidGroup(c, mid, groupID)
- 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.ShouldBeNil)
- })
- })
- }
- func TestManagerGetSpecialByID(t *testing.T) {
- var (
- c = context.TODO()
- id = int64(0)
- )
- convey.Convey("GetSpecialByID", t, func(ctx convey.C) {
- res, err := d.GetSpecialByID(c, id)
- 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.ShouldBeNil)
- })
- })
- }
- func TestManagerGetSepcialCount(t *testing.T) {
- var (
- c = context.TODO()
- conditions dao.Condition
- )
- convey.Convey("GetSepcialCount", t, func(ctx convey.C) {
- count, err := d.GetSepcialCount(c, conditions)
- 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 TestManagerGetSpecial(t *testing.T) {
- var (
- c = context.TODO()
- conditions dao.Condition
- )
- convey.Convey("GetSpecial", t, func(ctx convey.C) {
- res, err := d.GetSpecial(c, conditions)
- 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 TestManagerGetSpecialByMid(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(0)
- )
- convey.Convey("GetSpecialByMid", t, func(ctx convey.C) {
- res, err := d.GetSpecialByMid(c, mid)
- 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.ShouldBeNil)
- })
- })
- }
- func TestManagerRawUpSpecial(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(27515314)
- )
- convey.Convey("RawUpSpecial", t, func(ctx convey.C) {
- res, err := d.RawUpSpecial(c, mid)
- 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 TestManagerRawUpsSpecial(t *testing.T) {
- var (
- c = context.TODO()
- mids = []int64{27515314}
- )
- convey.Convey("RawUpsSpecial", t, func(ctx convey.C) {
- res, err := d.RawUpsSpecial(c, mids)
- 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)
- })
- })
- }
|