123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689 |
- package dao
- import (
- "context"
- "go-common/app/interface/main/dm2/model"
- "testing"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaokeyMsgPubLock(t *testing.T) {
- convey.Convey("keyMsgPubLock", t, func(ctx convey.C) {
- var (
- mid = int64(0)
- color = int64(0)
- rnd = int64(0)
- mode = int32(0)
- fontsize = int32(0)
- ip = ""
- msg = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := keyMsgPubLock(mid, color, rnd, mode, fontsize, ip, msg)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyOidPubLock(t *testing.T) {
- convey.Convey("keyOidPubLock", t, func(ctx convey.C) {
- var (
- mid = int64(0)
- oid = int64(0)
- ip = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := keyOidPubLock(mid, oid, ip)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyPubCntLock(t *testing.T) {
- convey.Convey("keyPubCntLock", t, func(ctx convey.C) {
- var (
- mid = int64(0)
- color = int64(0)
- mode = int32(0)
- fontsize = int32(0)
- ip = ""
- msg = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := keyPubCntLock(mid, color, mode, fontsize, ip, msg)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyCharPubLock(t *testing.T) {
- convey.Convey("keyCharPubLock", t, func(ctx convey.C) {
- var (
- mid = int64(0)
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := keyCharPubLock(mid, oid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyXML(t *testing.T) {
- convey.Convey("keyXML", t, func(ctx convey.C) {
- var (
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := keyXML(oid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeySubject(t *testing.T) {
- convey.Convey("keySubject", t, func(ctx convey.C) {
- var (
- tp = int32(0)
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := keySubject(tp, oid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyAjax(t *testing.T) {
- convey.Convey("keyAjax", t, func(ctx convey.C) {
- var (
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := keyAjax(oid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyJudge(t *testing.T) {
- convey.Convey("keyJudge", t, func(ctx convey.C) {
- var (
- tp = int8(0)
- oid = int64(0)
- dmid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := keyJudge(tp, oid, dmid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyDMLimitMid(t *testing.T) {
- convey.Convey("keyDMLimitMid", t, func(ctx convey.C) {
- var (
- mid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := keyDMLimitMid(mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyAdvanceCmt(t *testing.T) {
- convey.Convey("keyAdvanceCmt", t, func(ctx convey.C) {
- var (
- mid = int64(0)
- oid = int64(0)
- mode = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := keyAdvanceCmt(mid, oid, mode)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyAdvLock(t *testing.T) {
- convey.Convey("keyAdvLock", t, func(ctx convey.C) {
- var (
- mid = int64(0)
- cid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := keyAdvLock(mid, cid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyHistory(t *testing.T) {
- convey.Convey("keyHistory", t, func(ctx convey.C) {
- var (
- tp = int32(0)
- oid = int64(0)
- timestamp = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := keyHistory(tp, oid, timestamp)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyHistoryIdx(t *testing.T) {
- convey.Convey("keyHistoryIdx", t, func(ctx convey.C) {
- var (
- tp = int32(0)
- oid = int64(0)
- month = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := keyHistoryIdx(tp, oid, month)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaokeyDMMask(t *testing.T) {
- convey.Convey("keyDMMask", t, func(ctx convey.C) {
- var (
- tp = int32(0)
- oid = int64(0)
- plat = int8(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- p1 := keyDMMask(tp, oid, plat)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoSubjectCache(t *testing.T) {
- convey.Convey("SubjectCache", 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.SubjectCache(c, tp, oid)
- })
- })
- }
- func TestDaoSubjectsCache(t *testing.T) {
- convey.Convey("SubjectsCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oids = []int64{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- cached, missed, err := testDao.SubjectsCache(c, tp, oids)
- ctx.Convey("Then err should be nil.cached,missed should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(missed, convey.ShouldNotBeNil)
- ctx.So(cached, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddSubjectCache(t *testing.T) {
- convey.Convey("AddSubjectCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- sub = &model.Subject{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.AddSubjectCache(c, sub)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoDelXMLCache(t *testing.T) {
- convey.Convey("DelXMLCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.DelXMLCache(c, oid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoAddXMLCache(t *testing.T) {
- convey.Convey("AddXMLCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- oid = int64(0)
- value = []byte("")
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.AddXMLCache(c, oid, value)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoXMLCache(t *testing.T) {
- convey.Convey("XMLCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- data, err := testDao.XMLCache(c, oid)
- ctx.Convey("Then err should be nil.data should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(data, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAjaxDMCache(t *testing.T) {
- convey.Convey("AjaxDMCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- oid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- msgs, err := testDao.AjaxDMCache(c, oid)
- ctx.Convey("Then err should be nil.msgs should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(msgs, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddAjaxDMCache(t *testing.T) {
- convey.Convey("AddAjaxDMCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- oid = int64(0)
- msgs = []string{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.AddAjaxDMCache(c, oid, msgs)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSetDMJudgeCache(t *testing.T) {
- convey.Convey("SetDMJudgeCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int8(0)
- oid = int64(0)
- dmid = int64(0)
- l = &model.JudgeDMList{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.SetDMJudgeCache(c, tp, oid, dmid, l)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoDMJudgeCache(t *testing.T) {
- convey.Convey("DMJudgeCache", 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) {
- l, err := testDao.DMJudgeCache(c, tp, oid, dmid)
- ctx.Convey("Then err should be nil.l should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(l, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddMsgPubLock(t *testing.T) {
- convey.Convey("AddMsgPubLock", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- color = int64(0)
- rnd = int64(0)
- mode = int32(0)
- fontsize = int32(0)
- ip = ""
- msg = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.AddMsgPubLock(c, mid, color, rnd, mode, fontsize, ip, msg)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoMsgPublock(t *testing.T) {
- convey.Convey("MsgPublock", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- color = int64(0)
- rnd = int64(0)
- mode = int32(0)
- fontsize = int32(0)
- ip = ""
- msg = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- cached, err := testDao.MsgPublock(c, mid, color, rnd, mode, fontsize, ip, msg)
- ctx.Convey("Then err should be nil.cached should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(cached, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddOidPubLock(t *testing.T) {
- convey.Convey("AddOidPubLock", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- oid = int64(0)
- ip = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.AddOidPubLock(c, mid, oid, ip)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoOidPubLock(t *testing.T) {
- convey.Convey("OidPubLock", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- oid = int64(0)
- ip = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- cached, err := testDao.OidPubLock(c, mid, oid, ip)
- ctx.Convey("Then err should be nil.cached should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(cached, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddDMLimitCache(t *testing.T) {
- convey.Convey("AddDMLimitCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- limiter = &model.Limiter{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.AddDMLimitCache(c, mid, limiter)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoDMLimitCache(t *testing.T) {
- convey.Convey("DMLimitCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- limiter, err := testDao.DMLimitCache(c, mid)
- ctx.Convey("Then err should be nil.limiter should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(limiter, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddAdvanceCmtCache(t *testing.T) {
- convey.Convey("AddAdvanceCmtCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- oid = int64(0)
- mid = int64(0)
- mode = ""
- adv = &model.AdvanceCmt{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.AddAdvanceCmtCache(c, oid, mid, mode, adv)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoAdvanceCmtCache(t *testing.T) {
- convey.Convey("AdvanceCmtCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- oid = int64(0)
- mid = int64(0)
- mode = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- adv, err := testDao.AdvanceCmtCache(c, oid, mid, mode)
- ctx.Convey("Then err should be nil.adv should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(adv, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddAdvanceLock(t *testing.T) {
- convey.Convey("AddAdvanceLock", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- cid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- succeed := testDao.AddAdvanceLock(c, mid, cid)
- ctx.Convey("Then succeed should not be nil.", func(ctx convey.C) {
- ctx.So(succeed, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoDelAdvanceLock(t *testing.T) {
- convey.Convey("DelAdvanceLock", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- cid = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.DelAdvanceLock(c, mid, cid)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoDelAdvCache(t *testing.T) {
- convey.Convey("DelAdvCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(0)
- cid = int64(0)
- mode = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.DelAdvCache(c, mid, cid, mode)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoAddHistoryCache(t *testing.T) {
- convey.Convey("AddHistoryCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- timestamp = int64(0)
- value = []byte("")
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.AddHistoryCache(c, tp, oid, timestamp, value)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoHistoryCache(t *testing.T) {
- convey.Convey("HistoryCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- timestamp = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- data, err := testDao.HistoryCache(c, tp, oid, timestamp)
- ctx.Convey("Then err should be nil.data should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(data, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddHisIdxCache(t *testing.T) {
- convey.Convey("AddHisIdxCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- month = ""
- dates = []string{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.AddHisIdxCache(c, tp, oid, month, dates)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoHistoryIdxCache(t *testing.T) {
- convey.Convey("HistoryIdxCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- month = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- dates, err := testDao.HistoryIdxCache(c, tp, oid, month)
- ctx.Convey("Then err should be nil.dates should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(dates, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoDMMaskCache(t *testing.T) {
- convey.Convey("DMMaskCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- oid = int64(0)
- plat = int8(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- testDao.DMMaskCache(c, tp, oid, plat)
- })
- })
- }
- func TestDaoAddMaskCache(t *testing.T) {
- convey.Convey("AddMaskCache", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tp = int32(0)
- mask = &model.Mask{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := testDao.AddMaskCache(c, tp, mask)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
|