123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308 |
- package dao
- import (
- "context"
- "fmt"
- "go-common/app/job/main/ugcpay/model"
- "math/rand"
- "testing"
- "time"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoCountPaidOrderUser(t *testing.T) {
- convey.Convey("CountPaidOrderUser", t, func(ctx convey.C) {
- var (
- c = context.Background()
- beginTime = time.Now()
- endTime = time.Now()
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- count, err := d.CountPaidOrderUser(c, beginTime, endTime)
- 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 TestDaoCountRefundedOrderUser(t *testing.T) {
- convey.Convey("CountRefundedOrderUser", t, func(ctx convey.C) {
- var (
- c = context.Background()
- beginTime = time.Now()
- endTime = time.Now()
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- count, err := d.CountRefundedOrderUser(c, beginTime, endTime)
- 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 TestDaoCountDailyBillByVer(t *testing.T) {
- convey.Convey("CountDailyBillByVer", t, func(ctx convey.C) {
- var (
- c = context.Background()
- ver = int64(20181030)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- count, err := d.CountDailyBillByVer(c, ver)
- 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 TestDaoCountDailyBillByMonthVer(t *testing.T) {
- convey.Convey("CountDailyBillByMonthVer", t, func(ctx convey.C) {
- var (
- c = context.Background()
- monthVer = int64(20181030)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- count, err := d.CountDailyBillByMonthVer(c, monthVer)
- 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 TestDaoCountMonthlyBillByVer(t *testing.T) {
- convey.Convey("CountMonthlyBillByVer", t, func(ctx convey.C) {
- var (
- c = context.Background()
- ver = int64(201811)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- count, err := d.CountMonthlyBillByVer(c, ver)
- 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 TestDaoInsertLogTask(t *testing.T) {
- convey.Convey("InsertLogTask", t, func(ctx convey.C) {
- var (
- c = context.Background()
- data = &model.LogTask{
- Name: fmt.Sprintf("ut_%d", time.Now().Unix()),
- Expect: 233,
- }
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- id, err := d.InsertLogTask(c, data)
- ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(id, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoLogTask(t *testing.T) {
- convey.Convey("LogTask", t, func(ctx convey.C) {
- var (
- c = context.Background()
- name = "ut"
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- data, err := d.LogTask(c, name)
- 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 TestDaoTXIncrLogTaskSuccess(t *testing.T) {
- convey.Convey("TXIncrLogTaskSuccess", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- name = "ut"
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXIncrLogTaskSuccess(c, tx, name)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoIncrLogTaskFailure(t *testing.T) {
- convey.Convey("IncrLogTaskFailure", t, func(ctx convey.C) {
- var (
- c = context.Background()
- name = "ut"
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.IncrLogTaskFailure(c, name)
- 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 TestDaoAsset(t *testing.T) {
- convey.Convey("Asset", t, func(ctx convey.C) {
- var (
- c = context.Background()
- oid = int64(2333)
- otype = "archive"
- currency = "bp"
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- data, err := d.Asset(c, oid, otype, currency)
- 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 TestDaoSumPaidOrderUserRealFee(t *testing.T) {
- convey.Convey("SumPaidOrderUserRealFee", t, func(ctx convey.C) {
- var (
- c = context.Background()
- beginTime = time.Now()
- endTime = time.Now()
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- sum, err := d.SumPaidOrderUserRealFee(c, beginTime, endTime)
- ctx.Convey("Then err should be nil.sum should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(sum, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoSumRefundedOrderUserRealFee(t *testing.T) {
- convey.Convey("SumRefundedOrderUserRealFee", t, func(ctx convey.C) {
- var (
- c = context.Background()
- beginTime = time.Now()
- endTime = time.Now()
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- sum, err := d.SumRefundedOrderUserRealFee(c, beginTime, endTime)
- ctx.Convey("Then err should be nil.sum should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(sum, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoSumDailyBill(t *testing.T) {
- convey.Convey("SumDailyBill", t, func(ctx convey.C) {
- var (
- c = context.Background()
- ver = int64(20181030)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- sumIn, sumOut, err := d.SumDailyBill(c, ver)
- ctx.Convey("Then err should be nil.sumIn,sumOut should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(sumOut, convey.ShouldNotBeNil)
- ctx.So(sumIn, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoMinIDOrderPaid(t *testing.T) {
- convey.Convey("MinIDOrderPaid", t, func(ctx convey.C) {
- var (
- c = context.Background()
- beginTime = time.Now()
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- minID, err := d.MinIDOrderPaid(c, beginTime)
- ctx.Convey("Then err should be nil.minID should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(minID, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoOrderPaidList(t *testing.T) {
- convey.Convey("OrderPaidList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- beginTime = time.Now()
- endTime = time.Now()
- fromID = int64(0)
- limit = int(10)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- maxID, _, err := d.OrderPaidList(c, beginTime, endTime, fromID, limit)
- ctx.Convey("Then err should be nil.maxID,data should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- // ctx.So(data, convey.ShouldNotBeNil)
- ctx.So(maxID, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoMinIDOrderRefunded(t *testing.T) {
- convey.Convey("MinIDOrderRefunded", t, func(ctx convey.C) {
- var (
- c = context.Background()
- beginTime = time.Now()
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- minID, err := d.MinIDOrderRefunded(c, beginTime)
- ctx.Convey("Then err should be nil.minID should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(minID, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoOrderRefundedList(t *testing.T) {
- convey.Convey("OrderRefundedList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- beginTime = time.Now()
- endTime = time.Now()
- fromID = int64(0)
- limit = int(10)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- maxID, _, err := d.OrderRefundedList(c, beginTime, endTime, fromID, limit)
- ctx.Convey("Then err should be nil.maxID,data should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- // ctx.So(data, convey.ShouldNotBeNil)
- ctx.So(maxID, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoTXUpdateOrder(t *testing.T) {
- convey.Convey("TXUpdateOrder", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- order = &model.Order{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpdateOrder(c, tx, order)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXInsertOrderUserLog(t *testing.T) {
- convey.Convey("TXInsertOrderUserLog", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- data = &model.LogOrder{
- OrderID: "ut",
- Desc: "ut",
- }
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- id, err := d.TXInsertOrderUserLog(c, tx, data)
- ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(id, convey.ShouldNotBeNil)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoMinIDDailyBillByVer(t *testing.T) {
- convey.Convey("MinIDDailyBillByVer", t, func(ctx convey.C) {
- var (
- c = context.Background()
- ver = int64(20181030)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- minID, err := d.MinIDDailyBillByVer(c, ver)
- ctx.Convey("Then err should be nil.minID should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(minID, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoDailyBillListByVer(t *testing.T) {
- convey.Convey("DailyBillListByVer", t, func(ctx convey.C) {
- var (
- c = context.Background()
- ver = int64(20181030)
- fromID = int64(0)
- limit = int(10)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- maxID, data, err := d.DailyBillListByVer(c, ver, fromID, limit)
- ctx.Convey("Then err should be nil.maxID,data should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(data, convey.ShouldNotBeNil)
- ctx.So(maxID, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoMinIDDailyBillByMonthVer(t *testing.T) {
- convey.Convey("MinIDDailyBillByMonthVer", t, func(ctx convey.C) {
- var (
- c = context.Background()
- monthVer = int64(201811)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- minID, err := d.MinIDDailyBillByMonthVer(c, monthVer)
- ctx.Convey("Then err should be nil.minID should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(minID, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoDailyBillListByMonthVer(t *testing.T) {
- convey.Convey("DailyBillListByMonthVer", t, func(ctx convey.C) {
- var (
- c = context.Background()
- monthVer = int64(201811)
- fromID = int64(0)
- limit = int(10)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- maxID, data, err := d.DailyBillListByMonthVer(c, monthVer, fromID, limit)
- ctx.Convey("Then err should be nil.maxID,data should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(data, convey.ShouldNotBeNil)
- ctx.So(maxID, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoTXInsertLogDailyBill(t *testing.T) {
- convey.Convey("TXInsertLogDailyBill", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- log = &model.LogBillDaily{
- OrderID: fmt.Sprintf("ut_%d", time.Now().Unix()),
- }
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- id, err := d.TXInsertLogDailyBill(c, tx, log)
- ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(id, convey.ShouldNotBeNil)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXInsertLogMonthlyBill(t *testing.T) {
- convey.Convey("TXInsertLogMonthlyBill", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- log = &model.LogBillMonthly{
- BillID: fmt.Sprintf("ut_%d", time.Now().Unix()),
- BillUserDailyID: fmt.Sprintf("ut_%d", time.Now().Unix()),
- }
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- id, err := d.TXInsertLogMonthlyBill(c, tx, log)
- ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(id, convey.ShouldNotBeNil)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoMinIDMonthlyBill(t *testing.T) {
- convey.Convey("MinIDMonthlyBill", t, func(ctx convey.C) {
- var (
- c = context.Background()
- ver = int64(201811)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- minID, err := d.MinIDMonthlyBill(c, ver)
- ctx.Convey("Then err should be nil.minID should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(minID, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoMonthlyBillList(t *testing.T) {
- convey.Convey("MonthlyBillList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- ver = int64(201811)
- fromID = int64(0)
- limit = int(10)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- maxID, data, err := d.MonthlyBillList(c, ver, fromID, limit)
- ctx.Convey("Then err should be nil.maxID,data should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(data, convey.ShouldNotBeNil)
- ctx.So(maxID, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoDailyBill(t *testing.T) {
- convey.Convey("DailyBill", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(46333)
- biz = "asset"
- currency = "bp"
- ver = int64(20181030)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- data, err := d.DailyBill(c, mid, biz, currency, ver)
- 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 TestDaoInsertDailyBill(t *testing.T) {
- convey.Convey("InsertDailyBill", t, func(ctx convey.C) {
- var (
- c = context.Background()
- bill = &model.DailyBill{
- MonthVer: 201811,
- }
- )
- bill.BillID = fmt.Sprintf("ut_%d", time.Now().Unix())
- bill.MID = 46333
- bill.Biz = fmt.Sprintf("ut_%d", time.Now().Unix())
- bill.Currency = "bp"
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- id, err := d.InsertDailyBill(c, bill)
- ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(id, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoTXUpdateDailyBill(t *testing.T) {
- convey.Convey("TXUpdateDailyBill", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- bill = &model.DailyBill{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpdateDailyBill(c, tx, bill)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXUpsertDeltaDailyBill(t *testing.T) {
- convey.Convey("TXUpsertDeltaDailyBill", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- bill = &model.DailyBill{}
- deltaIn = int64(0)
- deltaOut = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpsertDeltaDailyBill(c, tx, bill, deltaIn, deltaOut)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXUpdateDeltaDailyBill(t *testing.T) {
- convey.Convey("TXUpdateDeltaDailyBill", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- deltaIn = int64(0)
- deltaOut = int64(0)
- mid = int64(0)
- biz = "archive"
- currency = "bp"
- ver = int64(20181030)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpdateDeltaDailyBill(c, tx, deltaIn, deltaOut, mid, biz, currency, ver)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoMonthlyBill(t *testing.T) {
- convey.Convey("MonthlyBill", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(46333)
- biz = "asset"
- currency = "bp"
- ver = int64(201811)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- data, err := d.MonthlyBill(c, mid, biz, currency, ver)
- 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 TestDaoInsertMonthlyBill(t *testing.T) {
- convey.Convey("InsertMonthlyBill", t, func(ctx convey.C) {
- var (
- c = context.Background()
- bill = &model.Bill{
- BillID: fmt.Sprintf("ut_%d", time.Now().Unix()),
- MID: 46333,
- Biz: fmt.Sprintf("ut_%d", time.Now().Unix()),
- Currency: "bp",
- }
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- id, err := d.InsertMonthlyBill(c, bill)
- ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(id, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoTXUpdateMonthlyBill(t *testing.T) {
- convey.Convey("TXUpdateMonthlyBill", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- bill = &model.Bill{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpdateMonthlyBill(c, tx, bill)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXUpsertDeltaMonthlyBill(t *testing.T) {
- convey.Convey("TXUpsertDeltaMonthlyBill", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- bill = &model.Bill{}
- deltaIn = int64(0)
- deltaOut = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpsertDeltaMonthlyBill(c, tx, bill, deltaIn, deltaOut)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXUpdateDeltaMonthlyBill(t *testing.T) {
- convey.Convey("TXUpdateDeltaMonthlyBill", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- deltaIn = int64(0)
- deltaOut = int64(0)
- mid = int64(46333)
- biz = "asset"
- currency = "bp"
- ver = int64(201811)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpdateDeltaMonthlyBill(c, tx, deltaIn, deltaOut, mid, biz, currency, ver)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoMinIDUserAccount(t *testing.T) {
- convey.Convey("MinIDUserAccount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- beginTime = time.Now()
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- minID, err := d.MinIDUserAccount(c, beginTime)
- ctx.Convey("Then err should be nil.minID should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(minID, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoUserAccountList(t *testing.T) {
- convey.Convey("UserAccountList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- beginTime = time.Now()
- endTime = time.Now()
- fromID = int64(0)
- limit = int(10)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- maxID, _, err := d.UserAccountList(c, beginTime, endTime, fromID, limit)
- ctx.Convey("Then err should be nil.maxID,datas should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- // ctx.So(datas, convey.ShouldNotBeNil)
- ctx.So(maxID, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoInsertUserAccount(t *testing.T) {
- convey.Convey("InsertUserAccount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- account = &model.UserAccount{
- MID: 46333,
- }
- )
- account.Biz = fmt.Sprintf("ut_%d", time.Now().Unix())
- account.Currency = "bp"
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- id, err := d.InsertUserAccount(c, account)
- ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(id, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoUserAccount(t *testing.T) {
- convey.Convey("UserAccount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(46333)
- biz = "asset"
- currency = "bp"
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- data, err := d.UserAccount(c, mid, biz, currency)
- 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 TestDaoTXUpdateUserAccount(t *testing.T) {
- convey.Convey("TXUpdateUserAccount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- account = &model.UserAccount{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpdateUserAccount(c, tx, account)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXUpsertDeltaUserAccount(t *testing.T) {
- convey.Convey("TXUpsertDeltaUserAccount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- account = &model.UserAccount{
- MID: 46333,
- }
- deltaBalance = int64(0)
- )
- account.Currency = "bp"
- account.Biz = "asset"
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpsertDeltaUserAccount(c, tx, account, deltaBalance)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXUpdateDeltaUserAccount(t *testing.T) {
- convey.Convey("TXUpdateDeltaUserAccount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- deltaBalance = int64(0)
- mid = int64(46333)
- biz = "asset"
- currency = "bp"
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpdateDeltaUserAccount(c, tx, deltaBalance, mid, biz, currency)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXInsertUserAccountLog(t *testing.T) {
- convey.Convey("TXInsertUserAccountLog", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- accountLog = &model.AccountLog{
- Name: fmt.Sprintf("ut_%d", time.Now().Unix()),
- }
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := d.TXInsertUserAccountLog(c, tx, accountLog)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoBizAccount(t *testing.T) {
- convey.Convey("BizAccount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- biz = "asset"
- currency = "bp"
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- data, err := d.BizAccount(c, biz, currency)
- 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 TestDaoInsertBizAccount(t *testing.T) {
- convey.Convey("InsertBizAccount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- account = &model.BizAccount{
- Biz: fmt.Sprintf("ut_%d", time.Now().Unix()),
- Currency: "bp",
- }
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- id, err := d.InsertBizAccount(c, account)
- ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(id, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoTXUpdateBizAccount(t *testing.T) {
- convey.Convey("TXUpdateBizAccount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- account = &model.BizAccount{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpdateBizAccount(c, tx, account)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXUpsertDeltaBizAccount(t *testing.T) {
- convey.Convey("TXUpsertDeltaBizAccount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- account = &model.BizAccount{
- Biz: "asset",
- Currency: "bp",
- }
- deltaBalance = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpsertDeltaBizAccount(c, tx, account, deltaBalance)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXUpdateDeltaBizAccount(t *testing.T) {
- convey.Convey("TXUpdateDeltaBizAccount", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- deltaBalance = int64(0)
- biz = "asset"
- currency = "bp"
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpdateDeltaBizAccount(c, tx, deltaBalance, biz, currency)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXInsertBizAccountLog(t *testing.T) {
- convey.Convey("TXInsertBizAccountLog", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- accountLog = &model.AccountLog{
- Name: fmt.Sprintf("ut_%d", time.Now().Unix()),
- }
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := d.TXInsertBizAccountLog(c, tx, accountLog)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoAggrIncomeUser(t *testing.T) {
- convey.Convey("AggrIncomeUser", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(46333)
- currency = "bp"
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- data, err := d.AggrIncomeUser(c, mid, currency)
- 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 TestDaoInsertAggrIncomeUser(t *testing.T) {
- convey.Convey("InsertAggrIncomeUser", t, func(ctx convey.C) {
- var (
- c = context.Background()
- aggr = &model.AggrIncomeUser{
- MID: int64(2333*1000) + rand.Int63n(1000),
- }
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- id, err := d.InsertAggrIncomeUser(c, aggr)
- ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(id, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoTXUpdateAggrIncomeUser(t *testing.T) {
- convey.Convey("TXUpdateAggrIncomeUser", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- aggr = &model.AggrIncomeUser{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpdateAggrIncomeUser(c, tx, aggr)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXUpsertDeltaAggrIncomeUser(t *testing.T) {
- convey.Convey("TXUpsertDeltaAggrIncomeUser", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- aggr = &model.AggrIncomeUser{
- MID: 46333,
- Currency: "bp",
- }
- deltaPaySuccess = int64(0)
- deltaPayError = int64(0)
- deltaTotalIn = int64(0)
- deltaTotalOut = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpsertDeltaAggrIncomeUser(c, tx, aggr, deltaPaySuccess, deltaPayError, deltaTotalIn, deltaTotalOut)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXUpdateDeltaAggrIncomeUser(t *testing.T) {
- convey.Convey("TXUpdateDeltaAggrIncomeUser", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- deltaPaySuccess = int64(0)
- deltaPayError = int64(0)
- deltaTotalIn = int64(0)
- deltaTotalOut = int64(0)
- mid = int64(46333)
- currency = "bp"
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpdateDeltaAggrIncomeUser(c, tx, deltaPaySuccess, deltaPayError, deltaTotalIn, deltaTotalOut, mid, currency)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoAggrIncomeUserAsset(t *testing.T) {
- convey.Convey("AggrIncomeUserAsset", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mid = int64(46333)
- currency = "bp"
- ver = int64(201810)
- oid = int64(10110846)
- otype = "archive"
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- data, err := d.AggrIncomeUserAsset(c, mid, currency, ver, oid, otype)
- 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 TestDaoInsertAggrIncomeUserAsset(t *testing.T) {
- convey.Convey("InsertAggrIncomeUserAsset", t, func(ctx convey.C) {
- var (
- c = context.Background()
- aggr = &model.AggrIncomeUserAsset{
- MID: 46333,
- OID: 10110846,
- OType: fmt.Sprintf("ut_%d", time.Now().Unix()),
- Ver: 201810,
- Currency: "bp",
- }
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- id, err := d.InsertAggrIncomeUserAsset(c, aggr)
- ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(id, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoTXUpdateAggrIncomeUserAsset(t *testing.T) {
- convey.Convey("TXUpdateAggrIncomeUserAsset", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- aggr = &model.AggrIncomeUserAsset{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpdateAggrIncomeUserAsset(c, tx, aggr)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXUpsertDeltaAggrIncomeUserAsset(t *testing.T) {
- convey.Convey("TXUpsertDeltaAggrIncomeUserAsset", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- aggr = &model.AggrIncomeUserAsset{
- MID: 46333,
- OID: 10110846,
- OType: "archive",
- Ver: 201810,
- Currency: "bp",
- }
- deltaPaySuccess = int64(0)
- deltaPayError = int64(0)
- deltaTotalIn = int64(0)
- deltaTotalOut = int64(0)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpsertDeltaAggrIncomeUserAsset(c, tx, aggr, deltaPaySuccess, deltaPayError, deltaTotalIn, deltaTotalOut)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXUpdateDeltaAggrIncomeUserAsset(t *testing.T) {
- convey.Convey("TXUpdateDeltaAggrIncomeUserAsset", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- deltaPaySuccess = int64(0)
- deltaPayError = int64(0)
- deltaTotalIn = int64(0)
- deltaTotalOut = int64(0)
- mid = int64(46333)
- currency = "bp"
- ver = int64(201810)
- oid = int64(10110846)
- otype = "archive"
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpdateDeltaAggrIncomeUserAsset(c, tx, deltaPaySuccess, deltaPayError, deltaTotalIn, deltaTotalOut, mid, currency, ver, oid, otype)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoOrderBadDebt(t *testing.T) {
- convey.Convey("OrderBadDebt", t, func(ctx convey.C) {
- var (
- c = context.Background()
- orderID = "666"
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- data, err := d.OrderBadDebt(c, orderID)
- 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 TestDaoInsertOrderBadDebt(t *testing.T) {
- convey.Convey("InsertOrderBadDebt", t, func(ctx convey.C) {
- var (
- c = context.Background()
- order = &model.OrderBadDebt{
- OrderID: fmt.Sprintf("ut_%d", time.Now().Unix()),
- Type: "ut",
- }
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- id, err := d.InsertOrderBadDebt(c, order)
- ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(id, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoTXUpdateOrderBadDebt(t *testing.T) {
- convey.Convey("TXUpdateOrderBadDebt", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- order = &model.OrderBadDebt{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- rows, err := d.TXUpdateOrderBadDebt(c, tx, order)
- 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)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
- func TestDaoTXInsertOrderRechargeShell(t *testing.T) {
- convey.Convey("TXInsertOrderRechargeShell", t, func(ctx convey.C) {
- var (
- c = context.Background()
- tx, _ = d.BeginTran(c)
- order = &model.OrderRechargeShell{
- MID: 46333,
- OrderID: fmt.Sprintf("ut_%d", time.Now().Unix()),
- Biz: fmt.Sprintf("ut_%d", time.Now().Unix()),
- PayMSG: "ut",
- }
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- id, err := d.TXInsertOrderRechargeShell(c, tx, order)
- ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(id, convey.ShouldNotBeNil)
- })
- })
- ctx.Reset(func() {
- tx.Commit()
- })
- })
- }
|