123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385 |
- package dao
- import (
- "context"
- xtime "go-common/library/time"
- "testing"
- "time"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoSubject(t *testing.T) {
- convey.Convey("Subject", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.Subject(c, tp, oid)
- })
- })
- }
- func TestDaoSubjects(t *testing.T) {
- convey.Convey("Subjects", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oids = []int64{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.Subjects(c, tp, oids)
- })
- })
- }
- func TestDaoUptSubAttr(t *testing.T) {
- convey.Convey("UptSubAttr", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- attr = int32(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- affect, err := testDao.UptSubAttr(c, tp, oid, attr)
- ctx.Convey("Then err should be nil.affect should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(affect, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoIncrSubMoveCount(t *testing.T) {
- convey.Convey("IncrSubMoveCount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- count = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- affect, err := testDao.IncrSubMoveCount(c, tp, oid, count)
- ctx.Convey("Then err should be nil.affect should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(affect, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoUpSubjectMCount(t *testing.T) {
- convey.Convey("UpSubjectMCount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- cnt = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- affect, err := testDao.UpSubjectMCount(c, tp, oid, cnt)
- ctx.Convey("Then err should be nil.affect should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(affect, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoUpSubjectPool(t *testing.T) {
- convey.Convey("UpSubjectPool", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- childpool = int32(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- affect, err := testDao.UpSubjectPool(c, tp, oid, childpool)
- ctx.Convey("Then err should be nil.affect should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(affect, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoIncrSubjectCount(t *testing.T) {
- convey.Convey("IncrSubjectCount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- count = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- affect, err := testDao.IncrSubjectCount(c, tp, oid, count)
- ctx.Convey("Then err should be nil.affect should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(affect, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoDMIDs(t *testing.T) {
- convey.Convey("DMIDs", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- ps = int64(0)
- pe = int64(0)
- limit = int64(0)
- pool = int32(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.DMIDs(c, tp, oid, ps, pe, limit, pool)
- })
- })
- }
- func TestDaoIndexs(t *testing.T) {
- convey.Convey("Indexs", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.Indexs(c, tp, oid)
- })
- })
- }
- func TestDaoIndexByid(t *testing.T) {
- convey.Convey("IndexByid", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int8(0)
- oid = int64(0)
- dmid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.IndexByid(c, tp, oid, dmid)
- })
- })
- }
- func TestDaoIndexsByid(t *testing.T) {
- convey.Convey("IndexsByid", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- dmids = []int64{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.IndexsByid(c, tp, oid, dmids)
- })
- })
- }
- func TestDaoJudgeIndex(t *testing.T) {
- convey.Convey("JudgeIndex", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int8(0)
- oid = int64(0)
- ctime1 = xtime.Time(time.Now().Unix())
- ctime2 = xtime.Time(time.Now().Unix())
- prog1 = int32(0)
- prog2 = int32(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.JudgeIndex(c, tp, oid, ctime1, ctime2, prog1, prog2)
- })
- })
- }
- func TestDaoContent(t *testing.T) {
- convey.Convey("Content", t, func(ctx convey.C) {
- var (
- c = context.Background()
- oid = int64(0)
- dmid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- ct, err := testDao.Content(c, oid, dmid)
- ctx.Convey("Then err should be nil.ct should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(ct, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoContents(t *testing.T) {
- convey.Convey("Contents", t, func(ctx convey.C) {
- var (
- c = context.Background()
- oid = int64(0)
- dmids = []int64{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- ctsMap, err := testDao.Contents(c, oid, dmids)
- ctx.Convey("Then err should be nil.ctsMap should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(ctsMap, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoContentsSpecial(t *testing.T) {
- convey.Convey("ContentsSpecial", t, func(ctx convey.C) {
- var (
- c = context.Background()
- dmids = []int64{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.ContentsSpecial(c, dmids)
- })
- })
- }
- func TestDaoUpdateDMStat(t *testing.T) {
- convey.Convey("UpdateDMStat", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- state = int32(0)
- dmids = []int64{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.UpdateDMStat(c, tp, oid, state, dmids)
- })
- })
- }
- func TestDaoUpdateUserDMStat(t *testing.T) {
- convey.Convey("UpdateUserDMStat", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- mid = int64(0)
- state = int32(0)
- dmids = []int64{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.UpdateUserDMStat(c, tp, oid, mid, state, dmids)
- })
- })
- }
- func TestDaoUpdateDMPool(t *testing.T) {
- convey.Convey("UpdateDMPool", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- pool = int32(0)
- dmids = []int64{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.UpdateDMPool(c, tp, oid, pool, dmids)
- })
- })
- }
- func TestDaoUpdateDMAttr(t *testing.T) {
- convey.Convey("UpdateDMAttr", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- dmid = int64(0)
- attr = int32(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- affect, err := testDao.UpdateDMAttr(c, tp, oid, dmid, attr)
- ctx.Convey("Then err should be nil.affect should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(affect, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoDMCount(t *testing.T) {
- convey.Convey("DMCount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- typ = int32(0)
- oid = int64(0)
- states = []int64{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.DMCount(c, typ, oid, states)
- })
- })
- }
- func TestDaoSpecialDmLocation(t *testing.T) {
- convey.Convey("SpecialDmLocation", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.SpecialDmLocation(c, tp, oid)
- })
- })
- }
- func TestDaoSpecalDMs(t *testing.T) {
- convey.Convey("SpecalDMs", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.SpecalDMs(c, tp, oid)
- })
- })
- }
- func TestDaoAddUpperConfig(t *testing.T) {
- convey.Convey("AddUpperConfig", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- advPermit = int8(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- affect, err := testDao.AddUpperConfig(c, mid, advPermit)
- ctx.Convey("Then err should be nil.affect should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(affect, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoUpperConfig(t *testing.T) {
- convey.Convey("UpperConfig", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- advPermit, err := testDao.UpperConfig(c, mid)
- ctx.Convey("Then err should be nil.advPermit should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(advPermit, convey.ShouldNotBeNil)
- })
- })
- })
- }
|