Initial commit

This commit is contained in:
Donny
2019-04-22 20:46:32 +08:00
commit 49ab8aadd1
25441 changed files with 4055000 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
package subtitle
import (
"context"
"go-common/app/interface/main/dm2/model"
"go-common/app/interface/main/dm2/rpc/client"
"go-common/library/ecode"
"reflect"
"testing"
"github.com/bouk/monkey"
"github.com/smartystreets/goconvey/convey"
)
func TestSubtitleView(t *testing.T) {
convey.Convey("View", t, func(ctx convey.C) {
var (
c = context.Background()
aid = int64(24416433)
)
ctx.Convey("testSubtitleView", func(ctx convey.C) {
mock := monkey.PatchInstanceMethod(reflect.TypeOf(d.sub), "SubtitleSubjectSubmitGet",
func(_ *client.Service, _ context.Context, _ *model.ArgArchiveID) (res *model.SubtitleSubjectReply, err error) {
return nil, ecode.CreativeSubtitleAPIErr
})
defer mock.Unpatch()
res, err := d.View(c, aid)
ctx.Convey("testSubtitleView", func(ctx convey.C) {
ctx.So(err, convey.ShouldNotBeNil)
ctx.So(res, convey.ShouldBeNil)
})
})
})
}