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,61 @@
package service
import (
"context"
"flag"
"path/filepath"
"testing"
"go-common/app/admin/main/sms/conf"
pb "go-common/app/service/main/sms/api"
. "github.com/smartystreets/goconvey/convey"
)
var s *Service
func init() {
dir, _ := filepath.Abs("../cmd/sms-admin-test.toml")
flag.Set("conf", dir)
if err := conf.Init(); err != nil {
panic(err)
}
s = New(conf.Conf)
}
func TestAddTemplate(t *testing.T) {
Convey("add tpl", t, func() {
req := &pb.AddTemplateReq{
Tcode: "test",
Template: "test",
Stype: 2,
Submitter: "wj",
}
_, err := s.AddTemplate(context.TODO(), req)
t.Log(err)
})
}
func TestUpdateTemplate(t *testing.T) {
Convey("update tpl", t, func() {
req := &pb.UpdateTemplateReq{
Tcode: "test",
Template: "test",
Stype: 2,
Status: 1,
Submitter: "wj",
}
_, err := s.UpdateTemplate(context.TODO(), req)
So(err, ShouldNotBeNil)
})
}
func TestTemplateList(t *testing.T) {
Convey("tpl list", t, func() {
req := &pb.TemplateListReq{Pn: 1, Ps: 10}
res, err := s.TemplateList(context.TODO(), req)
So(err, ShouldBeNil)
So(res.Total, ShouldBeGreaterThan, 0)
So(res.List, ShouldNotBeEmpty)
})
}