123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- package dao
- import (
- "context"
- "testing"
- "go-common/app/interface/main/dm/model"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaorptTable(t *testing.T) {
- convey.Convey("rptTable", t, func(convCtx convey.C) {
- var (
- cid = int64(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- p1 := rptTable(cid)
- convCtx.Convey("Then p1 should not be nil.", func(convCtx convey.C) {
- convCtx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaorptUserTable(t *testing.T) {
- convey.Convey("rptUserTable", t, func(convCtx convey.C) {
- var (
- dmid = int64(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- p1 := rptUserTable(dmid)
- convCtx.Convey("Then p1 should not be nil.", func(convCtx convey.C) {
- convCtx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoRptLogTable(t *testing.T) {
- convey.Convey("RptLogTable", t, func(convCtx convey.C) {
- var (
- dmid = int64(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- p1 := RptLogTable(dmid)
- convCtx.Convey("Then p1 should not be nil.", func(convCtx convey.C) {
- convCtx.So(p1, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddReport(t *testing.T) {
- convey.Convey("AddReport", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- rpt = &model.Report{}
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- id, err := testDao.AddReport(c, rpt)
- convCtx.Convey("Then err should be nil.id should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(id, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoAddReportUser(t *testing.T) {
- convey.Convey("AddReportUser", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- u = &model.User{}
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- id, err := testDao.AddReportUser(c, u)
- convCtx.Convey("Then err should be nil.id should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(id, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoReportLog(t *testing.T) {
- convey.Convey("ReportLog", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- dmid = int64(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- res, err := testDao.ReportLog(c, dmid)
- 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 TestDaoReport(t *testing.T) {
- convey.Convey("Report", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- cid = int64(0)
- dmid = int64(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- rpt, err := testDao.Report(c, cid, dmid)
- convCtx.Convey("Then err should be nil.rpt should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- convCtx.So(rpt, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoUpdateReportStat(t *testing.T) {
- convey.Convey("UpdateReportStat", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- cid = int64(0)
- dmid = int64(0)
- state = int8(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- affect, err := testDao.UpdateReportStat(c, cid, dmid, state)
- 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 TestDaoUpdateReportUPOp(t *testing.T) {
- convey.Convey("UpdateReportUPOp", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- cid = int64(0)
- dmid = int64(0)
- op = int8(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- affect, err := testDao.UpdateReportUPOp(c, cid, dmid, op)
- 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 TestDaoAddReportLog(t *testing.T) {
- convey.Convey("AddReportLog", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- lg = &model.RptLog{}
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- err := testDao.AddReportLog(c, lg)
- convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoReportUser(t *testing.T) {
- convey.Convey("ReportUser", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- dmid = int64(123)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- _, err := testDao.ReportUser(c, dmid)
- convCtx.Convey("Then err should be nil.users should not be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoSetReportUserFinished(t *testing.T) {
- convey.Convey("SetReportUserFinished", t, func(convCtx convey.C) {
- var (
- c = context.Background()
- dmid = int64(0)
- )
- convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
- err := testDao.SetReportUserFinished(c, dmid)
- convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
- convCtx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
|