123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- package service
- import (
- "context"
- "fmt"
- "testing"
- "go-common/app/admin/main/mcn/model"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestServiceMcnSignEntry(t *testing.T) {
- convey.Convey("McnSignEntry", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNSignEntryReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := s.McnSignEntry(c, arg)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestServiceMcnSignList(t *testing.T) {
- convey.Convey("McnSignList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNSignStateReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := s.McnSignList(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 TestServiceMcnSignOP(t *testing.T) {
- convey.Convey("McnSignOP", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNSignStateOpReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := s.McnSignOP(c, arg)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestServiceMcnUPReviewList(t *testing.T) {
- convey.Convey("McnUPReviewList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNUPStateReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := s.McnUPReviewList(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 TestServiceMcnUPOP(t *testing.T) {
- convey.Convey("McnUPOP", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNUPStateOpReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := s.McnUPOP(c, arg)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestServiceMcnPermitOP(t *testing.T) {
- convey.Convey("McnPermitOP", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNSignPermissionReq{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := s.McnPermitOP(c, arg)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestServicegetPermitOpenOrClosed(t *testing.T) {
- convey.Convey("getPermitOpenOrClosed", t, func(ctx convey.C) {
- var (
- a = uint32(5)
- b = uint32(5)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- open, closed := s.getPermitOpenOrClosed(a, b)
- ctx.Convey("Then open,closed should not be nil.", func(ctx convey.C) {
- ctx.So(closed, convey.ShouldNotBeNil)
- ctx.So(open, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestServicegetUpPermitString(t *testing.T) {
- convey.Convey("getPermitOpenOrClosed", t, func(ctx convey.C) {
- var (
- a = uint32(5)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- ps := s.getUpPermitString(a)
- ctx.Convey("Then open,closed should not be nil.", func(ctx convey.C) {
- ctx.So(ps, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestServiceMcnUPPermitList(t *testing.T) {
- convey.Convey("McnUPPermitList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNUPPermitStateReq{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- res, err := s.McnUPPermitList(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 TestServiceMcnUPPermitOP(t *testing.T) {
- convey.Convey("McnUPPermitOP", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNUPPermitOPReq{}
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := s.McnUPPermitOP(c, arg)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestServiceMCNList(t *testing.T) {
- convey.Convey("MCNList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNListReq{State: -1}
- )
- arg.MCNMID = 12345
- arg.Export = "csv"
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := s.MCNList(c, arg)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- for k, v := range res.List {
- fmt.Printf("re[%d]:%+v", k, v)
- }
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestServiceMCNPayEdit(t *testing.T) {
- convey.Convey("MCNPayEdit", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNPayEditReq{}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := s.MCNPayEdit(c, arg)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestServiceMCNPayStateEdit(t *testing.T) {
- convey.Convey("MCNPayStateEdit", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNPayStateEditReq{ID: 1, MCNMID: 212895899, SignID: 1}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := s.MCNPayStateEdit(c, arg)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestServiceMCNStateEdit(t *testing.T) {
- convey.Convey("MCNStateEdit", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNStateEditReq{ID: 1, MCNMID: 1212, Action: model.McnAccountRestore}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := s.MCNStateEdit(c, arg)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestServiceMCNRenewal(t *testing.T) {
- convey.Convey("MCNRenewal", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNRenewalReq{ID: 5, MCNMID: 27515432, BeginDate: "2018-09-22", EndDate: "2019-09-23", ContractLink: "ContractLink"}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := s.MCNRenewal(c, arg)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestServiceMCNInfo(t *testing.T) {
- convey.Convey("MCNInfo", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNInfoReq{ID: 9}
- )
- arg.MCNMID = 27515432
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- res, err := s.MCNInfo(c, arg)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- fmt.Println(res)
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestServiceMCNUPList(t *testing.T) {
- convey.Convey("McnUPList", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNUPListReq{SignID: 3, State: -1, SortFansCountActive: "asc"}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- res, err := s.MCNUPList(c, arg)
- ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
- for k, v := range res.List {
- fmt.Printf("re[%d]:%+v \n", k, v)
- }
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(res, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestServiceMCNUPStateEdit(t *testing.T) {
- convey.Convey("MCNUPStateEdit", t, func(ctx convey.C) {
- var (
- c = context.Background()
- arg = &model.MCNUPStateEditReq{ID: 1, SignID: 1}
- )
- ctx.Convey("When everything goes positive", func(ctx convey.C) {
- err := s.MCNUPStateEdit(c, arg)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
|