123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- package elec
- import (
- "context"
- "testing"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestElecUserInfo(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(2089809)
- ip = "127.0.0.1"
- )
- convey.Convey("UserInfo", t, func(ctx convey.C) {
- st, err := d.UserInfo(c, mid, ip)
- ctx.Convey("Then err should be nil.st should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(st, convey.ShouldNotBeNil)
- })
- })
- }
- func TestElecUserUpdate(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(2089809)
- st = int8(1)
- ip = "127.0.0.1"
- )
- convey.Convey("UserUpdate", t, func(ctx convey.C) {
- u, err := d.UserUpdate(c, mid, st, ip)
- ctx.Convey("Then err should be nil.u should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(u, convey.ShouldNotBeNil)
- })
- })
- }
- func TestElecArcUpdate(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(2089809)
- aid = int64(10106491)
- st = int8(1)
- ip = "127.0.0.1"
- )
- convey.Convey("ArcUpdate", t, func(ctx convey.C) {
- err := d.ArcUpdate(c, mid, aid, st, ip)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestElecNotify(t *testing.T) {
- var (
- c = context.TODO()
- ip = ""
- )
- convey.Convey("Notify", t, func(ctx convey.C) {
- nt, err := d.Notify(c, ip)
- ctx.Convey("Then err should be nil.nt should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(nt, convey.ShouldNotBeNil)
- })
- })
- }
- func TestElecStatus(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(2089809)
- ip = "127.0.0.1"
- )
- convey.Convey("Status", t, func(ctx convey.C) {
- st, err := d.Status(c, mid, ip)
- ctx.Convey("Then err should be nil.st should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(st, convey.ShouldNotBeNil)
- })
- })
- }
- func TestElecUpStatus(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(2089809)
- spday = int(1)
- ip = "127.0.0.1"
- )
- convey.Convey("UpStatus", t, func(ctx convey.C) {
- err := d.UpStatus(c, mid, spday, ip)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- }
- func TestElecRecentRank(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(2089809)
- size = int64(10)
- ip = "127.0.0.1"
- )
- convey.Convey("RecentRank", t, func(ctx convey.C) {
- rec, err := d.RecentRank(c, mid, size, ip)
- ctx.Convey("Then err should be nil.rec should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rec, convey.ShouldNotBeNil)
- })
- })
- }
- func TestElecCurrentRank(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(2089809)
- ip = "127.0.0.1"
- )
- convey.Convey("CurrentRank", t, func(ctx convey.C) {
- cur, err := d.CurrentRank(c, mid, ip)
- ctx.Convey("Then err should be nil.cur should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(cur, convey.ShouldNotBeNil)
- })
- })
- }
- func TestElecTotalRank(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(2089809)
- ip = "127.0.0.1"
- )
- convey.Convey("TotalRank", t, func(ctx convey.C) {
- tol, err := d.TotalRank(c, mid, ip)
- ctx.Convey("Then err should be nil.tol should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(tol, convey.ShouldNotBeNil)
- })
- })
- }
- func TestElecDailyBill(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(2089809)
- pn = int(1)
- ps = int(10)
- ip = "127.0.0.1"
- begin = "2018-01-04"
- end = "2019-01-04"
- )
- convey.Convey("DailyBill", t, func(ctx convey.C) {
- bl, err := d.DailyBill(c, mid, pn, ps, begin, end, ip)
- ctx.Convey("Then err should be nil.bl should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(bl, convey.ShouldNotBeNil)
- })
- })
- }
- func TestElecBalance(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(2089809)
- ip = "127.0.0.1"
- )
- convey.Convey("Balance", t, func(ctx convey.C) {
- bal, err := d.Balance(c, mid, ip)
- ctx.Convey("Then err should be nil.bal should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(bal, convey.ShouldNotBeNil)
- })
- })
- }
- func TestElecRecentElec(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(2089809)
- pn = int(1)
- ps = int(10)
- ip = "127.0.0.1"
- )
- convey.Convey("RecentElec", t, func(ctx convey.C) {
- rec, err := d.RecentElec(c, mid, pn, ps, ip)
- ctx.Convey("Then err should be nil.rec should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rec, convey.ShouldNotBeNil)
- })
- })
- }
- func TestElecRemarkList(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(2089809)
- pn = int(1)
- ps = int(10)
- begin = ""
- end = ""
- ip = "127.0.0.1"
- )
- convey.Convey("RemarkList", t, func(ctx convey.C) {
- rec, err := d.RemarkList(c, mid, pn, ps, begin, end, ip)
- ctx.Convey("Then err should be nil.rec should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(rec, convey.ShouldNotBeNil)
- })
- })
- }
- func TestElecRemarkDetail(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(2089809)
- id = int64(0)
- ip = "127.0.0.1"
- )
- convey.Convey("RemarkDetail", t, func(ctx convey.C) {
- re, err := d.RemarkDetail(c, mid, id, ip)
- ctx.Convey("Then err should be nil.re should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(re, convey.ShouldNotBeNil)
- })
- })
- }
- func TestElecRemark(t *testing.T) {
- var (
- c = context.TODO()
- mid = int64(2089809)
- id = int64(0)
- msg = ""
- ak = ""
- ck = ""
- ip = "127.0.0.1"
- )
- convey.Convey("Remark", t, func(ctx convey.C) {
- status, err := d.Remark(c, mid, id, msg, ak, ck, ip)
- ctx.Convey("Then err should be nil.status should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(status, convey.ShouldNotBeNil)
- })
- })
- }
|