123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- package dao
- import (
- "context"
- "go-common/app/interface/main/dm/model"
- "testing"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoAddProtectApply(t *testing.T) {
- convey.Convey("AddProtectApply", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- pas = []*model.Pa{
- {
- ID: 123,
- CID: 1,
- UID: 1,
- },
- }
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- affect, err := testDao.AddProtectApply(c, pas)
- convCtx.Convey("Then err should be nil.affect should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(affect, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoProtectApplyTime(t *testing.T) {
- convey.Convey("ProtectApplyTime", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- dmid = int64(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- no, err := testDao.ProtectApplyTime(c, dmid)
- convCtx.Convey("Then err should be nil.no should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(no, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoProtectApplies(t *testing.T) {
- convey.Convey("ProtectApplies", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- uid = int64(123)
- aid = int64(111)
- order = ""
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- _, err := testDao.ProtectApplies(c, uid, aid, order)
- convCtx.Convey("Then err should be nil.res should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoProtectAids(t *testing.T) {
- convey.Convey("ProtectAids", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- uid = int64(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- res, err := testDao.ProtectAids(c, uid)
- convCtx.Convey("Then err should be nil.res should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoUptPaStatus(t *testing.T) {
- convey.Convey("UptPaStatus", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- uid = int64(123)
- ids = "123"
- status = int(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- affect, err := testDao.UptPaStatus(c, uid, ids, status)
- convCtx.Convey("Then err should be nil.affect should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(affect, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoProtectApplyByIDs(t *testing.T) {
- convey.Convey("ProtectApplyByIDs", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- uid = int64(123)
- ids = "123"
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- res, err := testDao.ProtectApplyByIDs(c, uid, ids)
- convCtx.Convey("Then err should be nil.res should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoUptPaNoticeSwitch(t *testing.T) {
- convey.Convey("UptPaNoticeSwitch", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- uid = int64(0)
- status = int(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- affect, err := testDao.UptPaNoticeSwitch(c, uid, status)
- convCtx.Convey("Then err should be nil.affect should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(affect, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoPaNoticeClose(t *testing.T) {
- convey.Convey("PaNoticeClose", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- uids = []int64{123}
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- res, err := testDao.PaNoticeClose(c, uids)
- convCtx.Convey("Then err should be nil.res should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoProtectApplyStatistics(t *testing.T) {
- convey.Convey("ProtectApplyStatistics", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- res, err := testDao.ProtectApplyStatistics(c)
- convCtx.Convey("Then err should be nil.res should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaotwoDayAgo22(t *testing.T) {
- convey.Convey("twoDayAgo22", t, func(convCtx convey.C) {
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- p1 := twoDayAgo22()
- convCtx.Convey("Then p1 should not be nil.", func(convCtx convey.C) {
- convCtx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoPaUsrStat(t *testing.T) {
- convey.Convey("PaUsrStat", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- res, err := testDao.PaUsrStat(c)
- convCtx.Convey("Then err should be nil.res should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
|