123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- package service
- import (
- "context"
- "testing"
- adminmodel "go-common/app/admin/main/mcn/model"
- "go-common/app/interface/main/mcn/model"
- "go-common/app/interface/main/mcn/model/mcnmodel"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestServicegetMcnWithState(t *testing.T) {
- convey.Convey("getMcnWithState", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mcnmid = int64(0)
- state = model.MCNSignState(1)
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- mcnSign, err := s.getMcnWithState(c, mcnmid, state)
- ctx.Convey("Then err should be nil.mcnSign should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(mcnSign, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestServiceMcnGetState(t *testing.T) {
- convey.Convey("McnGetState", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &mcnmodel.GetStateReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := s.McnGetState(c, arg)
- 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 TestServiceMcnExist(t *testing.T) {
- convey.Convey("McnExist", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &mcnmodel.GetStateReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := s.McnExist(c, arg)
- 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 TestServiceMcnApply(t *testing.T) {
- convey.Convey("McnApply", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &mcnmodel.McnApplyReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := s.McnApply(c, arg)
- 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 TestServiceMcnBindUpApply(t *testing.T) {
- convey.Convey("McnBindUpApply", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &mcnmodel.McnBindUpApplyReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := s.McnBindUpApply(c, arg)
- 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 TestServiceMcnUpConfirm(t *testing.T) {
- convey.Convey("McnUpConfirm", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &mcnmodel.McnUpConfirmReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := s.McnUpConfirm(c, arg)
- 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 TestServiceMcnUpGetBind(t *testing.T) {
- convey.Convey("McnUpGetBind", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &mcnmodel.McnUpGetBindReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := s.McnUpGetBind(c, arg)
- 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 TestServiceMcnDataSummary(t *testing.T) {
- convey.Convey("McnDataSummary", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &mcnmodel.McnGetDataSummaryReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := s.McnDataSummary(c, arg)
- 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 TestServiceMcnDataUpList(t *testing.T) {
- convey.Convey("McnDataUpList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &mcnmodel.McnGetUpListReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := s.McnDataUpList(c, arg)
- 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 TestServiceMcnGetOldInfo(t *testing.T) {
- convey.Convey("McnGetOldInfo", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &mcnmodel.McnGetMcnOldInfoReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := s.McnGetOldInfo(c, arg)
- 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 TestCheckPermission(t *testing.T) {
- convey.Convey("checkPermission", t, func(ctx convey.C) {
- var (
- c = context.Background()
- mcnMid, upMid int64 = 15555180, 27515410
- permissions = []adminmodel.AttrBasePermit{adminmodel.AttrBasePermitBit, adminmodel.AttrDataPermitBit}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res := s.checkPermission(c, mcnMid, upMid, permissions...)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- ctx.So(res, convey.ShouldBeTrue)
- })
- })
- })
- }
|