123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708 |
- package dao
- import (
- "bytes"
- "context"
- "fmt"
- "math/rand"
- "testing"
- "time"
- "go-common/app/service/main/coupon/model"
- "go-common/library/database/sql"
- xtime "go-common/library/time"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaohitInfo(t *testing.T) {
- var (
- mid = int64(0)
- )
- convey.Convey("hitInfo", t, func(ctx convey.C) {
- p1 := hitInfo(mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaohitChangeLog(t *testing.T) {
- var (
- mid = int64(0)
- )
- convey.Convey("hitChangeLog", t, func(ctx convey.C) {
- p1 := hitChangeLog(mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaohitUser(t *testing.T) {
- var (
- mid = int64(0)
- )
- convey.Convey("hitUser", t, func(ctx convey.C) {
- p1 := hitUser(mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaohitUserLog(t *testing.T) {
- var (
- mid = int64(0)
- )
- convey.Convey("hitUserLog", t, func(ctx convey.C) {
- p1 := hitUserLog(mid)
- ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoBeginTran(t *testing.T) {
- var (
- c = context.TODO()
- )
- convey.Convey("BeginTran", t, func(ctx convey.C) {
- p1, err := d.BeginTran(c)
- ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(p1, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoCouponList(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(0)
- state = int8(0)
- ct = int8(0)
- no = int64(0)
- )
- convey.Convey("CouponList", t, func(ctx convey.C) {
- _, err := d.CouponList(c, mid, state, ct, no)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoCouponNoStartCheckList(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(0)
- state = int8(0)
- ct = int8(0)
- no = int64(0)
- )
- convey.Convey("CouponNoStartCheckList", t, func(ctx convey.C) {
- _, err := d.CouponNoStartCheckList(c, mid, state, ct, no)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoBlanceNoStartCheckList(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(0)
- ct = int8(0)
- no = int64(0)
- )
- convey.Convey("BlanceNoStartCheckList", t, func(ctx convey.C) {
- _, err := d.BlanceNoStartCheckList(c, mid, ct, no)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoByOrderNO(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(1)
- orderNO = "1235378892"
- ct = int8(1)
- )
- convey.Convey("ByOrderNO", t, func(ctx convey.C) {
- r, err := d.ByOrderNO(c, mid, orderNO, ct)
- ctx.Convey("Then err should be nil.r should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(r, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoUpdateCouponInUse(t *testing.T) {
- var (
- c = context.TODO()
- tx = &sql.Tx{}
- cp = &model.CouponInfo{}
- a int64
- err error
- )
- convey.Convey("UpdateCouponInUse", t, func(ctx convey.C) {
- tx, err = d.BeginTran(c)
- ctx.So(err, convey.ShouldBeNil)
- a, err = d.UpdateCouponInUse(c, tx, cp)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(a, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoInsertPointHistory(t *testing.T) {
- var (
- c = context.TODO()
- tx = &sql.Tx{}
- l = &model.CouponChangeLog{}
- err error
- )
- convey.Convey("InsertPointHistory", t, func(ctx convey.C) {
- tx, err = d.BeginTran(c)
- ctx.So(err, convey.ShouldBeNil)
- a, err := d.InsertPointHistory(c, tx, l)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(a, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoCouponInfo(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(27515401)
- token = "581807988720180417190545"
- )
- convey.Convey("CouponInfo", t, func(ctx convey.C) {
- r, err := d.CouponInfo(c, mid, token)
- ctx.Convey("Then err should be nil.r should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(r, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoCountByState(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(0)
- state = int8(0)
- no = int64(0)
- stime = time.Now()
- )
- convey.Convey("CountByState", t, func(ctx convey.C) {
- count, err := d.CountByState(c, mid, state, no, stime)
- 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 TestDaoCouponPage(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(0)
- state = int8(0)
- no = int64(0)
- start = int(0)
- ps = int(0)
- stime = time.Now()
- )
- convey.Convey("CouponPage", t, func(ctx convey.C) {
- _, err := d.CouponPage(c, mid, state, no, start, ps, stime)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoAddCoupon(t *testing.T) {
- var (
- c = context.TODO()
- cp = &model.CouponInfo{
- Mid: 1,
- CouponToken: token(),
- State: 0,
- StartTime: time.Now().Unix(),
- ExpireTime: time.Now().AddDate(0, 0, 1).Unix(),
- }
- )
- convey.Convey("AddCoupon", t, func(ctx convey.C) {
- a, err := d.AddCoupon(c, cp)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(a, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoBatchAddCoupon(t *testing.T) {
- var (
- c = context.TODO()
- tx = &sql.Tx{}
- mid = int64(0)
- cps = []*model.CouponInfo{}
- err error
- a int64
- )
- convey.Convey("BatchAddCoupon", t, func(ctx convey.C) {
- cp := &model.CouponInfo{}
- cp.CouponToken = token()
- cp.Mid = mid
- cp.State = model.NotUsed
- cp.StartTime = time.Now().Unix()
- cp.ExpireTime = time.Now().AddDate(0, 0, 2).Unix()
- cp.Origin = 1
- cp.CouponType = 1
- cp.CTime = xtime.Time(time.Now().Unix())
- cp.BatchToken = "1234"
- cps = append(cps, cp)
- tx, err = d.BeginTran(c)
- ctx.So(err, convey.ShouldBeNil)
- a, err = d.BatchAddCoupon(c, tx, mid, cps)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(a, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoUpdateCoupon(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(27515800)
- state = int8(0)
- useVer = int64(0)
- ver = int64(1)
- couponToken = "510204683920180420110002"
- )
- convey.Convey("UpdateCoupon", t, func(ctx convey.C) {
- _, err := d.UpdateCoupon(c, mid, state, useVer, ver, couponToken)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoByThirdTradeNo(t *testing.T) {
- var (
- c = context.TODO()
- thirdTradeNo = "12156121892"
- ct = int8(2)
- )
- convey.Convey("ByThirdTradeNo", t, func(ctx convey.C) {
- r, err := d.ByThirdTradeNo(c, thirdTradeNo, ct)
- ctx.Convey("Then err should be nil.r should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(r, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoCouponBlances(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(520)
- ct = int8(2)
- no = int64(0)
- )
- convey.Convey("CouponBlances", t, func(ctx convey.C) {
- _, err := d.CouponBlances(c, mid, ct, no)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoUpdateBlance(t *testing.T) {
- var (
- c = context.TODO()
- tx = &sql.Tx{}
- id = int64(0)
- mid = int64(0)
- ver = int64(0)
- balance = int64(0)
- a int64
- err error
- )
- convey.Convey("UpdateBlance", t, func(ctx convey.C) {
- tx, err = d.BeginTran(c)
- ctx.So(err, convey.ShouldBeNil)
- a, err = d.UpdateBlance(c, tx, id, mid, ver, balance)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(a, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoBatchUpdateBlance(t *testing.T) {
- var (
- c = context.TODO()
- tx = &sql.Tx{}
- mid = int64(1)
- blances = []*model.CouponBalanceInfo{}
- err error
- )
- blances = append(blances, &model.CouponBalanceInfo{
- ID: 116197,
- Balance: 1,
- Ver: 0,
- })
- convey.Convey("BatchUpdateBlance", t, func(ctx convey.C) {
- tx, err = d.BeginTran(c)
- ctx.So(err, convey.ShouldBeNil)
- _, err = d.BatchUpdateBlance(c, tx, mid, blances)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- err = tx.Commit()
- ctx.So(err, convey.ShouldBeNil)
- })
- }
- func TestDaoBatchInsertBlanceLog(t *testing.T) {
- var (
- c = context.TODO()
- tx = &sql.Tx{}
- mid = int64(0)
- ls = []*model.CouponBalanceChangeLog{}
- err error
- )
- convey.Convey("BatchInsertBlanceLog", t, func(ctx convey.C) {
- blog := new(model.CouponBalanceChangeLog)
- blog.OrderNo = "11"
- blog.Mid = mid
- blog.BatchToken = "123"
- blog.ChangeType = model.Consume
- blog.Ctime = xtime.Time(time.Now().Unix())
- ls = append(ls, blog)
- tx, err = d.BeginTran(c)
- ctx.So(err, convey.ShouldBeNil)
- _, err = d.BatchInsertBlanceLog(c, tx, mid, ls)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- err = tx.Commit()
- ctx.So(err, convey.ShouldBeNil)
- })
- }
- func TestDaoAddOrder(t *testing.T) {
- var (
- c = context.TODO()
- tx = &sql.Tx{}
- o = &model.CouponOrder{}
- a int64
- err error
- )
- convey.Convey("AddOrder", t, func(ctx convey.C) {
- tx, err = d.BeginTran(c)
- ctx.So(err, convey.ShouldBeNil)
- a, err = d.AddOrder(c, tx, o)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(a, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoAddOrderLog(t *testing.T) {
- var (
- c = context.TODO()
- tx = &sql.Tx{}
- o = &model.CouponOrderLog{}
- a int64
- err error
- )
- convey.Convey("AddOrderLog", t, func(ctx convey.C) {
- tx, err = d.BeginTran(c)
- ctx.So(err, convey.ShouldBeNil)
- a, err = d.AddOrderLog(c, tx, o)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(a, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoCouponCarToonCount(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(0)
- no = int64(0)
- ct = int8(0)
- state = int8(0)
- stime = time.Now()
- )
- convey.Convey("CouponCarToonCount", t, func(ctx convey.C) {
- count, err := d.CouponCarToonCount(c, mid, no, ct, state, stime)
- 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 TestDaoCouponNotUsedPage(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(0)
- ct = int8(0)
- no = int64(0)
- stime = time.Now()
- pn = int(0)
- ps = int(0)
- )
- convey.Convey("CouponNotUsedPage", t, func(ctx convey.C) {
- _, err := d.CouponNotUsedPage(c, mid, ct, no, stime, pn, ps)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoCouponExpirePage(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(27515301)
- ct = int8(1)
- no = time.Now().Unix()
- stime = time.Now().AddDate(-1, 0, 0)
- pn = int(1)
- ps = int(10)
- )
- convey.Convey("CouponExpirePage", t, func(ctx convey.C) {
- _, err := d.CouponExpirePage(c, mid, ct, no, stime, pn, ps)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoOrderUsedPage(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(0)
- state = int8(0)
- ct = int8(0)
- stime = time.Now()
- pn = int(0)
- ps = int(0)
- )
- convey.Convey("OrderUsedPage", t, func(ctx convey.C) {
- _, err := d.OrderUsedPage(c, mid, state, ct, stime, pn, ps)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoAddBalanceCoupon(t *testing.T) {
- var (
- c = context.TODO()
- tx = &sql.Tx{}
- b = &model.CouponBalanceInfo{}
- a int64
- err error
- )
- convey.Convey("AddBalanceCoupon", t, func(ctx convey.C) {
- tx, err = d.BeginTran(c)
- ctx.So(err, convey.ShouldBeNil)
- a, err = d.AddBalanceCoupon(c, tx, b)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(a, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoByMidAndBatchToken(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(1)
- batchToken = "441539420220180806174505"
- )
- convey.Convey("ByMidAndBatchToken", t, func(ctx convey.C) {
- _, err := d.ByMidAndBatchToken(c, mid, batchToken)
- ctx.Convey("Then err should be nil.r should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoAddBalanceChangeLog(t *testing.T) {
- var (
- c = context.TODO()
- tx = &sql.Tx{}
- bl = &model.CouponBalanceChangeLog{}
- a int64
- err error
- )
- convey.Convey("AddBalanceChangeLog", t, func(ctx convey.C) {
- tx, err = d.BeginTran(c)
- ctx.So(err, convey.ShouldBeNil)
- a, err = d.AddBalanceChangeLog(c, tx, bl)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(a, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoBatchInfo(t *testing.T) {
- var (
- c = context.TODO()
- token = "900364604420180912170927"
- )
- convey.Convey("BatchInfo", t, func(ctx convey.C) {
- r, err := d.BatchInfo(c, token)
- ctx.Convey("Then err should be nil.r should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(r, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoUpdateBatchInfo(t *testing.T) {
- var (
- c = context.TODO()
- tx = &sql.Tx{}
- token = ""
- count = int(0)
- a int64
- err error
- )
- convey.Convey("UpdateBatchInfo", t, func(ctx convey.C) {
- tx, err = d.BeginTran(c)
- ctx.So(err, convey.ShouldBeNil)
- a, err = d.UpdateBatchInfo(c, tx, token, count)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(a, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoUpdateBatchLimitInfo(t *testing.T) {
- var (
- c = context.TODO()
- tx = &sql.Tx{}
- token = ""
- count = int(0)
- a int64
- err error
- )
- convey.Convey("UpdateBatchLimitInfo", t, func(ctx convey.C) {
- tx, err = d.BeginTran(c)
- ctx.So(err, convey.ShouldBeNil)
- a, err = d.UpdateBatchLimitInfo(c, tx, token, count)
- ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(a, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoGrantCouponLog(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(0)
- token = ""
- ct = int8(0)
- )
- convey.Convey("GrantCouponLog", t, func(ctx convey.C) {
- _, err := d.GrantCouponLog(c, mid, token, ct)
- ctx.Convey("Then err should be nil.rs should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoAllBranchInfo(t *testing.T) {
- var (
- c = context.TODO()
- )
- convey.Convey("AllBranchInfo", t, func(ctx convey.C) {
- res, err := d.AllBranchInfo(c)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- }
- func TestDaoCountByBranchToken(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(0)
- token = ""
- )
- convey.Convey("CountByBranchToken", t, func(ctx convey.C) {
- count, err := d.CountByBranchToken(c, mid, token)
- 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)
- })
- })
- }
- // get coupon token
- func token() string {
- var b bytes.Buffer
- b.WriteString(fmt.Sprintf("%03d", time.Now().UnixNano()/1e6%1000))
- b.WriteString(time.Now().Format("20060102150405"))
- return b.String()
- }
- func TestDaoReceiveLog(t *testing.T) {
- var (
- c = context.Background()
- appkey = "7c7ac0db1aa05587"
- orderNo = "1536657724"
- ct int8 = 3
- )
- convey.Convey("ReceiveLog ", t, func(ctx convey.C) {
- r, err := d.ReceiveLog(c, appkey, orderNo, ct)
- ctx.Convey("Then err should be nil.r should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(r, convey.ShouldNotBeNil)
- })
- r, err = d.ReceiveLog(c, "", "", 21)
- ctx.Convey("Then err should be nil.r should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(r, convey.ShouldBeNil)
- })
- })
- }
- func TestDaoTxAddReceiveLog(t *testing.T) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- rlog = &model.CouponReceiveLog{Appkey: fmt.Sprintf("%d", time.Now().Unix()), CouponType: int8(rand.Int63n(127))}
- )
- convey.Convey("TxAddReceiveLog ", t, func(ctx convey.C) {
- err := d.TxAddReceiveLog(tx, rlog)
- if err == nil {
- if err = tx.Commit(); err != nil {
- tx.Rollback()
- }
- } else {
- tx.Rollback()
- }
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
|