123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- package up
- import (
- "context"
- "testing"
- "go-common/app/admin/main/mcn/model"
- xtime "go-common/library/time"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestUpTxAddMcnSignEntry(t *testing.T) {
- convey.Convey("TxAddMcnSignEntry", t, func(ctx convey.C) {
- var (
- tx, _ = d.BeginTran(context.Background())
- mcnMid = int64(0)
- beginDate = ""
- endDate = ""
- permission = uint32(0)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- lastID, err := d.TxAddMcnSignEntry(tx, mcnMid, beginDate, endDate, permission)
- t.Logf("last id=%d", lastID)
- defer tx.Rollback()
- ctx.Convey("Then err should be nil.lastID should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(lastID, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestUpTxAddMcnSignPay(t *testing.T) {
- convey.Convey("TxAddMcnSignPay", t, func(ctx convey.C) {
- var (
- tx, _ = d.BeginTran(context.Background())
- mcnMid = int64(0)
- signID = int64(0)
- payValue = int64(0)
- dueDate = ""
- note = ""
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- rows, err := d.TxAddMcnSignPay(tx, mcnMid, signID, payValue, dueDate, note)
- defer tx.Rollback()
- ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rows, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestUpUpMcnSignOP(t *testing.T) {
- convey.Convey("UpMcnSignOP", t, func(ctx convey.C) {
- var (
- c = context.Background()
- signID = int64(0)
- state = int8(0)
- rejectTime xtime.Time
- rejectReason = ""
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- rows, err := d.UpMcnSignOP(c, signID, state, rejectTime, rejectReason)
- ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rows, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestUpUpMcnUpOP(t *testing.T) {
- convey.Convey("UpMcnUpOP", t, func(ctx convey.C) {
- var (
- c = context.Background()
- signUpID = int64(0)
- state = int8(0)
- rejectTime xtime.Time
- rejectReason = ""
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- rows, err := d.UpMcnUpOP(c, signUpID, state, rejectTime, rejectReason)
- ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rows, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestUpTxMcnUpPermitOP(t *testing.T) {
- convey.Convey("TxMcnUpPermitOP", t, func(ctx convey.C) {
- var (
- tx, _ = d.BeginTran(context.Background())
- signID = int64(0)
- mcnMid = int64(0)
- upMid = int64(0)
- permission = uint32(0)
- upAuthLink = ""
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TxMcnUpPermitOP(tx, signID, mcnMid, upMid, permission, upAuthLink)
- defer tx.Rollback()
- ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rows, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestUpTxUpPermitApplyOP(t *testing.T) {
- convey.Convey("TxUpPermitApplyOP", t, func(ctx convey.C) {
- var (
- tx, _ = d.BeginTran(context.Background())
- arg = &model.McnUpPermissionApply{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TxUpPermitApplyOP(tx, arg)
- defer tx.Rollback()
- ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rows, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestUpMcnSigns(t *testing.T) {
- convey.Convey("McnSigns", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNSignStateReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- ms, err := d.McnSigns(c, arg)
- ctx.Convey("Then err should be nil.ms should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(ms, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestUpMcnSignTotal(t *testing.T) {
- convey.Convey("McnSignTotal", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNSignStateReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- count, err := d.McnSignTotal(c, arg)
- 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 TestUpMcnUpTotal(t *testing.T) {
- convey.Convey("McnUpTotal", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNUPStateReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- count, err := d.McnUpTotal(c, arg)
- 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 TestUpMcnUpPermits(t *testing.T) {
- convey.Convey("McnUpPermits", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNUPPermitStateReq{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- ms, err := d.McnUpPermits(c, arg)
- ctx.Convey("Then err should be nil.ms should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(ms, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestUpMcnUpPermit(t *testing.T) {
- convey.Convey("McnUpPermit", t, func(ctx convey.C) {
- var (
- c = context.Background()
- id = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- m, err := d.McnUpPermit(c, id)
- ctx.Convey("Then err should be nil.m should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(m, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestUpMcnUpPermitTotal(t *testing.T) {
- convey.Convey("McnUpPermitTotal", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNUPPermitStateReq{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- count, err := d.McnUpPermitTotal(c, arg)
- 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)
- })
- })
- })
- }
|